Websocket Connection limit how to set ?

Hi there, I programmed a WebSocket server in Java, with the Javax WebSocket library My operating systems are local Windows 10, Cloud Server on Ubuntu, Web Server Apache2 + Tomcat I’m doing my tests on both sides My problem; After 256 connections, other sockets are on hold and if I open some more sockets, the web server crashes and does not respond to any requests. I’ve searched the internet a lot, I applied what I saw but could not solve the problem. I thought the problem was due to java, I tried it in nodejs (npm express-ws lib), tested it locally, but the same problem happens after the 456 is connected. Please I need help I apologize for broken language. Thanks.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Site Moderator
Site Moderator badge
May 7, 2021
Accepted Answer

Hi @cihad,

I might be wrong buf if you are using Apache, you might have filled up Apache’s available workers. I think the default value was exactly 256.

You can open your Apache configuration file. In there you should see something similar to:

ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000

Increase both the ServerLimit and MaxClients options, restart Apache and see if this would solve your issue.

Regards, KFSys

Site Moderator
Site Moderator badge
May 10, 2021

Hi @cihad,

I see you were able to resolve the issue! I’m glad to see the advice helped and thank you for sharing that the solution worked!

If you ever come to face similar issue, please feel free to use the community! We’ll always be happy to try and assist you

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel