-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limited to 1024 concurrent connections #104
Comments
Try experimenting with the limits on your server. PHP's Sockets functions are little more than wrappers around the C standard library BSD Sockets, which rely heavily on the OS's settings. This might help: https://stackoverflow.com/questions/410616/increasing-the-maximum-number-of-tcp-ip-connections-in-linux |
My sysctl.conf is properly configured and limits.conf also. |
Okay, I've found that my PHP Sockets server is accepting more than 1024 sockets when I run it from the root. I'm starting it using this command. /etc/php/7.0/fpm/php-fpm.conf /etc/php/7.0/fpm/pool.d/www.conf /etc/security/limits.conf
Any suggestions? |
as @ghedipunk said the problem is core to php ( socket_select ) specificaly not from php-websocket. To be able to break that limit you'll have to modify the header file in C first then download php from source modify a file in php too then compile it. ( you'll have to undo the header file afterward because it'll affect any other app you install after ). It's a painfull process. I recommend you to use another backend like epoll. Select was design in another era while massive concurent alive connection not a thing. Select will parse the entire list of connection to know if a client send something in that specific loop, every time, as epoll will only read from client that send actually data. You'll need to install libev and you can use my version of php-websocket that support libev. |
Hi @Xaraknid , Is your fork compatible with PHP7+libev, because im currently using @ghedipunk 's WebSocket class (very great and fast) for a new LMS system for an university but the 1024 limit concurrent connections is too painfull and prevent scalability for big projects... I started to switch to your fork but there is some issues with the code like the "continue" at line 24 of libev.php, and even after switch the continue with a "return" statement there is theses errors generated from the "doHandshake" method :
I tried to mix @ghedipunk 's working doHandshake with your, it seems to work (no errors) but the websocket server cant read data from clients. I dont want to use Ratchet WS because its too fat and bloated, i prefer the fast and KISS approach of PHPWebsocket but we are in a dead end right now... |
Hello, the version I updated is not the most uptodate version I have I just never see the interest to upload it as no one seem to use it. I check my code and I comment the continue in my version, as I discover like you that cause problem but removing it was not enought. I add a few feature in my version and also it's work a little bit different. One last thing I worked on is trying to pass the Autobahn|Testsuite, few test not working. Let me clean my code of junk files (test purpose & information ) and my server name inside code and I'll publish it. ( It work on php7 ). |
Here my latest version I made. https://github.com/Xaraknid/PHP-Websockets/tree/revision-2 |
Hi,
It seems that php sockets module can maximum hold 1024 connections.
Is there any way to raise this limitation?
The text was updated successfully, but these errors were encountered: