B4J Question How much websocket threads can jserver create at same time

Modern_Digital

Member
Licensed User
Longtime User
Hi,

I have non-ui b4j server uses jserver library and websocket class and I want to know how much websocket threads can b4j jserver create and keeping it alive at same time.

Thank you.
 

Modern_Digital

Member
Licensed User
Longtime User
Thank you Erel, let's say I have a vps and a b4j server running inside it, what should I do or use on b4j server to make it accept millions of connections and keeping it alive at the same time, is this possible by using b4j server that uses jserver library or another library.
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
keeping it alive
This is probably a key element in your question as a server can maximum handle 65536 simultanious TCP sockets per single IP address (not a B4J limitation, just a hardware one).

This would mean you will have to start doing load-balancing over a lot of servers to keep millions of connections open (16 servers per million). Each of the servers will have to run an instance of your jServer app and something like HAProxy will have to be configured to pick one of the available sockets accross all the servers.
 
Upvote 0

Modern_Digital

Member
Licensed User
Longtime User
This is probably a key element in your question as a server can maximum handle 65536 simultanious TCP sockets per single IP address (not a B4J limitation, just a hardware one).

This would mean you will have to start doing load-balancing over a lot of servers to keep millions of connections open (16 servers per million). Each of the servers will have to run an instance of your jServer app and something like HAProxy will have to be configured to pick one of the available sockets accross all the servers.

Thank you @alwaysbusy for the explanation I appreciate it, I can not do what you mentioned but now it becomes clear to me what I have to do.

Very few sites need to handle millions of concurrent connections. Where will all of these these connections come from?

Thank you Erel, I was having a misunderstanding of the correct use of the jServer Library but now I think I know the right solution for me.
 
Upvote 0

keirS

Well-Known Member
Licensed User
Longtime User
This is probably a key element in your question as a server can maximum handle 65536 simultanious TCP sockets per single IP address (not a B4J limitation, just a hardware one).

This would mean you will have to start doing load-balancing over a lot of servers to keep millions of connections open (16 servers per million). Each of the servers will have to run an instance of your jServer app and something like HAProxy will have to be configured to pick one of the available sockets accross all the servers.

If you really had such high demand you would probably be best of using docker containers using AWS, GCP or Azure. I think all of them have load balancers and proxies which can deploy and close docker containers depending on the demand.
 
Upvote 0

Modern_Digital

Member
Licensed User
Longtime User
If you really had such high demand you would probably be best of using docker containers using AWS, GCP or Azure. I think all of them have load balancers and proxies which can deploy and close docker containers depending on the demand.

Thank you keirS, I appreciate it.
 
Upvote 0
Top