Coder Social home page Coder Social logo

Comments (28)

 avatar commented on May 3, 2024 9

Yeah I need to check this out. Too bad Apple computers are priced in a way that it makes no logical sense to ever buy them. At least the Swedish prices are simply unreal - 125% or 150% that of US prices.

Like... who the actual fuck wants to buy the new Macbook air for 15000 SEK that's like the price of four stolen cars. You can have much more joy with four stolen cars I tell you...

My gaming computer cost me 8000 SEK and it has a fucking geforce 980 as big as my thigh... and they want me to buy fucking integrated intel graphics for 15 thousand SEK wtf

from uwebsockets.js.

 avatar commented on May 3, 2024 1

Ah, lol.. I haven't even updated the Makefile since.. ever

from uwebsockets.js.

goriunov avatar goriunov commented on May 3, 2024 1

Agree :) Unfortunately my work place has another opinion so they provide macbooks to everyone.

from uwebsockets.js.

 avatar commented on May 3, 2024 1

I have WMware at home.. will fire that shit up when I can

from uwebsockets.js.

 avatar commented on May 3, 2024 1

@tleasure those numbers seem very reasonable. On Linux I get multiple times better IO compared to Node.js,

But on macOS it seems like the difference is not all that great - can macOS people try and compare the IO of hello world with nodejs?

Maybe it's just Linux being a lot more efficient than macOS as a system (wouldn't surprise me at all)?

from uwebsockets.js.

kevlened avatar kevlened commented on May 3, 2024
NODE=targets/node-v9.2.0 ABI=59 make `(uname -s)`
g++ -DLIBUS_USE_LIBUV -flto -O3 -c -fPIC -std=c++17 -I uWebSockets/uSockets/src -I uWebSockets/src src/addon.cpp -stdlib=libc++ -mmacosx-version-min=10.7 -undefined dynamic_lookup -I $NODE/include/node -o dist/uws_darwin_$ABI.node
clang: warning: argument unused during compilation: '-undefined dynamic_lookup' [-Wunused-command-line-argument]
src/addon.cpp:173:47: error: 'isolate' cannot be captured because it does not
      have automatic storage duration
    uWS::Loop::defaultLoop()->setPostHandler([isolate](uWS::Loop *) {
                                              ^
src/addon.cpp:5:10: note: 'isolate' declared here
Isolate *isolate;
         ^
1 error generated.
make[1]: *** [Darwin] Error 1
make: *** [default] Error 2

from uwebsockets.js.

 avatar commented on May 3, 2024

Thanks try again now

from uwebsockets.js.

kevlened avatar kevlened commented on May 3, 2024

Cool, builds now

$ node -v
v9.2.0
$ node
> process.platform
'darwin'
> process.versions.modules
'64'
>
$ ls dist/
uws.js                  uws_darwin_59.node      uws_darwin_64.node      uws_darwin_67.node
$ node examples/HelloWorld.js
/Users/len/playground/uWebSockets.js/dist/uws.js:8
		throw new Error('This version of µWS is not compatible with your Node.js build.');
		^

Error: This version of µWS is not compatible with your Node.js build.
    at module.exports (/Users/len/playground/uWebSockets.js/dist/uws.js:8:9)
    at Object.<anonymous> (/Users/len/playground/uWebSockets.js/dist/uws.js:10:3)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
    at Module.require (module.js:585:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/len/playground/uWebSockets.js/examples/HelloWorld.js:2:23)

from uwebsockets.js.

goriunov avatar goriunov commented on May 3, 2024

The same on node 10, mac OS

from uwebsockets.js.

tleasure avatar tleasure commented on May 3, 2024
g++ -DLIBUS_USE_LIBUV -flto -O3 -c -fPIC -std=c++17 -I uWebSockets/uSockets/src -I uWebSockets/src src/addon.cpp -I $NODE/include/node
g++ -flto -O3 *.o -std=c++17 -shared -static-libstdc++ -static-libgcc -s -o dist/uws_linux_$ABI.node
make[1]: Leaving directory `/www/repos/uWebSockets.js'
NODE=targets/node-v10.0.0 ABI=64 make `(uname -s)`
make[1]: Entering directory `/www/repos/uWebSockets.js'
gcc -DLIBUS_USE_LIBUV -flto -O3 -c -fPIC -I uWebSockets/uSockets/src uWebSockets/uSockets/src/*.c uWebSockets/uSockets/src/eventing/*.c
g++ -DLIBUS_USE_LIBUV -flto -O3 -c -fPIC -std=c++17 -I uWebSockets/uSockets/src -I uWebSockets/src src/addon.cpp -I $NODE/include/node
g++ -flto -O3 *.o -std=c++17 -shared -static-libstdc++ -static-libgcc -s -o dist/uws_linux_$ABI.node
make[1]: Leaving directory `/www/repos/uWebSockets.js'
NODE=targets/node-v11.1.0 ABI=67 make `(uname -s)`
make[1]: Entering directory `/www/repos/uWebSockets.js'
gcc -DLIBUS_USE_LIBUV -flto -O3 -c -fPIC -I uWebSockets/uSockets/src uWebSockets/uSockets/src/*.c uWebSockets/uSockets/src/eventing/*.c
g++ -DLIBUS_USE_LIBUV -flto -O3 -c -fPIC -std=c++17 -I uWebSockets/uSockets/src -I uWebSockets/src src/addon.cpp -I $NODE/include/node
g++ -flto -O3 *.o -std=c++17 -shared -static-libstdc++ -static-libgcc -s -o dist/uws_linux_$ABI.node
make[1]: Leaving directory `/www/repos/uWebSockets.js'
for f in dist/*.node; do chmod +x $f; done
node -v
v10.5.0
CentOS Linux release 7.5.1804 (Core)
Linux localdev2 3.10.0-862.9.1.el7.x86_64
node examples/HelloWorld.js
Listening to port 3000
Timers will not work until us_loop_integrate is done
Running 30s test @ http://127.0.0.1:3000/hello
  20 threads and 10000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    49.00ms   78.12ms   1.88s    98.87%
    Req/Sec     9.21k     3.09k   27.88k    74.81%
  5497186 requests in 30.09s, 550.47MB read
  Socket errors: connect 0, read 1797, write 0, timeout 56
Requests/sec: 182679.97
Transfer/sec:     18.29MB

from uwebsockets.js.

goriunov avatar goriunov commented on May 3, 2024

Mac os full error (i have printed e from catch method)

Error: dlopen(/Users/dmitrii/Desktop/github/uWebSockets.js/dist/uws_darwin_64.node, 1): no suitable image found.  Did find:
	/Users/dmitrii/Desktop/github/uWebSockets.js/dist/uws_darwin_64.node: unknown file type, first eight bytes: 0xDE 0xC0 0x17 0x0B 0x00 0x00 0x00 0x00
	/Users/dmitrii/Desktop/github/uWebSockets.js/dist/uws_darwin_64.node: unknown file type, first eight bytes: 0xDE 0xC0 0x17 0x0B 0x00 0x00 0x00 0x00
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:718:18)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at module.exports (/Users/dmitrii/Desktop/github/uWebSockets.js/dist/uws.js:5:15)
    at Object.<anonymous> (/Users/dmitrii/Desktop/github/uWebSockets.js/dist/uws.js:13:3)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
/Users/dmitrii/Desktop/github/uWebSockets.js/dist/uws.js:11
		throw new Error('This version of µWS is not compatible with your Node.js build.');
		^

Error: This version of µWS is not compatible with your Node.js build.
    at module.exports (/Users/dmitrii/Desktop/github/uWebSockets.js/dist/uws.js:11:9)
    at Object.<anonymous> (/Users/dmitrii/Desktop/github/uWebSockets.js/dist/uws.js:13:3)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/Users/dmitrii/Desktop/github/uWebSockets.js/examples/HelloWorld.js:2:23)

from uwebsockets.js.

 avatar commented on May 3, 2024

Yeah that's the same error I have heard about before. Something is wrong with the macOS build.

from uwebsockets.js.

andymans avatar andymans commented on May 3, 2024

Yep. Am on node 11.1.0 on OSX High Sierra. Getting same error as @goriunov. Will try it also on Linux (Alpine under Docker) as it's quite a popular deployment option, and report any issues (if any) with that env.

from uwebsockets.js.

 avatar commented on May 3, 2024

Maybe it works now, maybe not

from uwebsockets.js.

kevlened avatar kevlened commented on May 3, 2024
make[1]: `targets' is up to date.
NODE=targets/node-v9.2.0 ABI=59 make `(uname -s)`
gcc -mmacosx-version-min=10.7 -DLIBUS_USE_LIBUV -flto -O3 -c -fPIC -I uWebSockets/uSockets/src uWebSockets/uSockets/src/*.c uWebSockets/uSockets/src/eventing/*.c
In file included from uWebSockets/uSockets/src/context.c:2:
In file included from uWebSockets/uSockets/src/internal/common.h:9:
uWebSockets/uSockets/src/internal/eventing/libuv.h:6:10: fatal error: 'uv.h' file not found
#include <uv.h>
         ^~~~~~
1 error generated.
In file included from uWebSockets/uSockets/src/loop.c:2:
In file included from uWebSockets/uSockets/src/internal/common.h:9:
uWebSockets/uSockets/src/internal/eventing/libuv.h:6:10: fatal error: 'uv.h' file not found
#include <uv.h>
         ^~~~~~
1 error generated.
In file included from uWebSockets/uSockets/src/socket.c:2:
In file included from uWebSockets/uSockets/src/internal/common.h:9:
uWebSockets/uSockets/src/internal/eventing/libuv.h:6:10: fatal error: 'uv.h' file not found
#include <uv.h>
         ^~~~~~
1 error generated.
In file included from uWebSockets/uSockets/src/ssl.c:4:
In file included from uWebSockets/uSockets/src/internal/common.h:9:
uWebSockets/uSockets/src/internal/eventing/libuv.h:6:10: fatal error: 'uv.h' file not found
#include <uv.h>
         ^~~~~~
1 error generated.
In file included from uWebSockets/uSockets/src/eventing/epoll.c:2:
In file included from uWebSockets/uSockets/src/internal/common.h:9:
uWebSockets/uSockets/src/internal/eventing/libuv.h:6:10: fatal error: 'uv.h' file not found
#include <uv.h>
         ^~~~~~
1 error generated.
In file included from uWebSockets/uSockets/src/eventing/libuv.c:2:
In file included from uWebSockets/uSockets/src/internal/common.h:9:
uWebSockets/uSockets/src/internal/eventing/libuv.h:6:10: fatal error: 'uv.h' file not found
#include <uv.h>
         ^~~~~~
1 error generated.
make[1]: *** [Darwin] Error 1
make: *** [default] Error 2

from uwebsockets.js.

 avatar commented on May 3, 2024

Alright, should be close to working now. This code only works with Node.js 10 and 11

from uwebsockets.js.

kevlened avatar kevlened commented on May 3, 2024
$ node -v
v11.1.0
$ node examples/HelloWorld.js
Segmentation fault: 11
$ node -v
v10.10.0
$ node examples/HelloWorld.js
Segmentation fault: 11

from uwebsockets.js.

 avatar commented on May 3, 2024

👌

from uwebsockets.js.

 avatar commented on May 3, 2024

If you change the HelloWorld.js to only this:

var uWS = require('../dist/uws.js');
console.log(uWS);

Does it print { App: [Function], nextTick: [Function] }?

Does uWS.App(); work?

from uwebsockets.js.

goriunov avatar goriunov commented on May 3, 2024

@alexhultman it does not go farther than

const uWS = require(`./uws_${process.platform}_${process.versions.modules}.node`);

I have tried running

module.exports = (() => {
	try {
		console.log("1");
		const uWS = require(`./uws_${process.platform}_${process.versions.modules}.node`);
		console.log("2");

		/* We are not compatible with Node.js domain */
		// console.log(uWS);
		process.nextTick = (f, ...args) => uWS.nextTick(f.apply(...args));
		return uWS;
	} catch (e) {
		console.log("3", e);

		throw new Error('This version of µWS is not compatible with your Node.js build.\n\n' + e.toString());
	}
})();

and got output:

Dmitriis-MacBook-Pro:uWebSockets.js dmitrii$ node examples/HelloWorld.js
1
Segmentation fault: 11

from uwebsockets.js.

goriunov avatar goriunov commented on May 3, 2024

I have done some small checks it seg fault comes from uWS_App method if i comment

 uWS::Loop::defaultLoop()->setPostHandler([](uWS::Loop *) {
      emptyNextTickQueue(isolate);
   });

i can properly print:

{ App: [Function], nextTick: [Function] }

from uwebsockets.js.

 avatar commented on May 3, 2024

Then it should work. Just remove that nextTick thing (console.log will not print).

from uwebsockets.js.

goriunov avatar goriunov commented on May 3, 2024

Still have error/print even after removing nextTick. I have tracked seg fault to (not sure if i am aright though):

localApp->SetAlignedPointerInInternalField(0, new uWS::App());

// This one:
new uWS::App()

from uwebsockets.js.

 avatar commented on May 3, 2024

It runs on Linux and macOS now

from uwebsockets.js.

goriunov avatar goriunov commented on May 3, 2024

Working alright :)

from uwebsockets.js.

kevlened avatar kevlened commented on May 3, 2024

Works on mac for me too 💯

from uwebsockets.js.

 avatar commented on May 3, 2024

I've heard 90k req/sec vs. 52k on macOS yet on Linux you can see more like 120k vs. 20k. Let's see if this ratio difference is same for all

from uwebsockets.js.

 avatar commented on May 3, 2024

If you normalize spent CPU-time the numbers are a lot better. Basically it seems wrk does not stress the server fully on macOS for some reason, I only get up to 62% CPU time. You can also extra check this by running:

time node examples/HelloWorld.js and compare real-time with user space + system time and normalize by that.

from uwebsockets.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.