Closed Sam-Gram closed 1 year ago
Also just wanted to say thank you for maintaining this, good work.
I'm having a similar issue.
I have no problem when I run on my local dev machine.
When I bundle this up in a docker container and deploy it, I get the same "Compilation of µWebSockets has failed and there is no correct pre-compiled binary available..." error as @Sam-Gram.
This is built on a box that has the gcc compiler installed, and npm ci
throws no errors at all, so I can only assume it gets built correctly.
After npm ci
, the node_modules
and all the other production files are copied into the container, just like it has prior to trying to use eiows, and that worked fine prior to using eiows.
Is this because the container's architecture is different than the host that built it?
I created a workaround for my situation.
I perform a two-stage docker build.
The first stage loads all the build tools and libraries necessary to build the eiows optimized code:
RUN apk add build-base
RUN apk add gcompat
Then I call node w/ a .js
file that imports eiows and calls new
on the Server()
constructor. This triggers the build. (probably just the import does it)
Then I start the second stage of the build and copy the node_modules over from the the first stage, along with the rest of the project that I need for the runtime environment.
In the second stage I also have to apk add gcompat
to include the correct libraries.
That's it - the server now runs in the container when I deploy it.
Side note, it didn't optimize my performance in any noticeable way.
I have a socket test that connects 12 clients and then does end-to-end pings (one client sends a ping, all the other sockets respond with pong, the pinger then spits out the average end-to-end response).
I tie multiple server instances together with redis (standard socket.io w/redis).
My test would consist of sending the ping every 10ms. round-trips cost about 200ms on average. sometimes that went up to 300-400, sometimes it'd drop below 200, but it typically hung out at 200.
The server where two containers were running would get a load average of 20 and stay there for hours.
After using eiows, with the same tests, all the stats are the roughly the same, ~200ms round-trip and load average of 20.
It's probably optimized for some other usage than what I'm testing w/ my socket.io implementation.
My issue seemed to be fixed by installing python3 as a prereq.
This indeed seems like a build environment issue. Closing this issue now. Please reopen when you still experiencing issues.
I am getting the following error when I try to use eiows with a node 16 worker:
I am on Ubuntu 20.04.4 LTS Node 16.16.0 eiows: 4.1.2 socket.io 4.5.1 g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
If I try to require eiows in the main thread I get: