Closed incapdns closed 3 years ago
I just tried this with Cluster and Worker Threads and it works on both using different workers, Depending on how you make requests to the server it can re-use the same connection/worker, I see browsers Chrome/Firefox doing this. You should switch between using 2 different browsers to get it to use different workers
I have a doubt: I am running Debian through WSL (Windows Subsystem for Linux), and not a 100% Linux version (such as: Virtualbox or VMWare etc), could this be resulting in this problem?
I've tried using Firefox and even created a NodeJS application to generate a new connection (using request plugin) but the problem continues, so I think it may be related to WSL (Windows Subsystem for Linux)
Host System: Windows 10 x64
I have a doubt: I am running Debian through WSL (Windows Subsystem for Linux), and not a 100% Linux version (such as: Virtualbox or VMWare etc), could this be resulting in this problem?
If you want to know for sure you should use curl to make requests to server, curl localhost:1000
or curl mydomain.com
and it will alternate workers each request
I have a doubt: I am running Debian through WSL (Windows Subsystem for Linux), and not a 100% Linux version (such as: Virtualbox or VMWare etc), could this be resulting in this problem?
If you want to know for sure you should use
wget
to make requests to server, use it likewget localhost:1000
orwget mydomain.com
and it will alternate workers each request
Yes, plz verify: 1 Request: Google Chrome 2 Request: Firefox (Recent install + Anonymous tab) 3 Request: wget http://127.0.0.1:1000 4 Request: curl http://127.0.0.1:1000
So looks like probably something up with WSL preventing that. I dont have WSL to try it. I use VirtualBox with Vagrant to automate stuff. You should probably be running the full VM and not the WSL to get more accurate virtual environment
Yes, it really seems to be the case.
I tested it on a virtualized Linux server (using VirtualBox) and it worked 100%, The printscreen of the operation on the virtual machine below:
Problem solved !
But I'm curious because it doesn't work on WIndows or on Linux subversions like WSL
A google search produces stuff like "WSL Network communication (although possible) requires several layers to pass through, making the WSL not ideal for low-level networking processes" and "Networking on WSL isn't fully reliable. WSL allows you to communicate with a network, but it may not be the best way to do so as it needs to pass through a few layers in order to do work"
A Virtual Machine runs a complete Linux Kernel. In contrast to WSL, the programs access the real kernel and drivers. When you use WSL the processes are scheduled by the Windows Scheduler. The network communications are processed by Windows. If you want to run or develop programs, using a virtual machine is a better option
Got it, thanks anyway for helping.
I will be using uWebSockets.js for a VPS server application with the Centos 8 operating system, now that the question has been resolved, I feel more relaxed.
I will be closing the topic, thank you!
Multithreading is known to work: https://levelup.gitconnected.com/serving-100k-requests-second-from-a-fanless-raspberry-pi-4-over-ethernet-fdd2c2e05a1e
Error: Only one process is receiving requests, as the PID displayed in a request is the same for all connections Example: (Line 18) 1 request: PID 5839 2 request: PID 5839 3 request: PID 5839
Observation: This problem happens only with the uWebSockets.js module, when using the standard HTTP module of NodeJS or a c ++ addon module for NodeJS like Mitol or Hellepoll the load distribution works correctly
HTTP command: curl --no-keepalive http://127.0.0.1:1000
WS code:
Linux version: Distributor ID: Debian Description: Debian GNU/Linux 9.13 (stretch) Release: 9.13 Codename: stretch
uws Server Code:
If debugging is necessary, I would like to request remote access to my computer via TeamViewer or Anydesk or another tool.