idevelop
idevelop

Reputation: 199

High number of persistent connections

I'm setting up a project and one of the main questions is how to implement a simple message queueing system (something along the line of a messenger chat system). I would like to avoid polling, but there will most likely be a lot of concurrent connections (tens of thousands). These will be HTTP+SSL connections, started from an application not a browser.

One solution I found would be DNS Load Balancing: distribute these persistent connections across a bunch of nginx webservers.

What do you think? Any other possible solutions?

Upvotes: 2

Views: 655

Answers (4)

sfossen
sfossen

Reputation: 4778

If you are planning on using web services (XML message passing ), you can use gsoap, which has an included web server sample application, which uses thread pools. I've run a server using this and mysql ( for persistent state ). I agree with Ryan on reducing/eliminating the statefulness of the application.

Upvotes: 1

Ryann Graham
Ryann Graham

Reputation: 8229

For load balancing, keeping the application server stateless will open up the field significantly. Once you've got that, you're free to use almost any generic load balancer. From something protocol specific like HTTP load balancers to the generic TCP level load balancers.

Keep it stateless, the rest will be trivial in comparison.

Upvotes: 2

Adam Davis
Adam Davis

Reputation: 93565

Have you considered peer-to-peer? The state of the art in punching through firewalls is actually very effective especially since you're running your own client software in each instance, and you have servers to start the connection.

More work, but significantly less server resources.

Also, write your own server software - make sure it can handle a lot of connections and is extraordinarily lightweight and you should be able to handle thousands of connections per server before you do load balancing.

-Adam

Upvotes: 0

Dave Swersky
Dave Swersky

Reputation: 34810

DNS load balancing will allow you to distribute queries between multiple IP addresses, which could be multiple servers. Keep in mind that your clients could get different servers from one request to another, so your applicaiton can't use local state management. Your applicaiton will have to store its state in a centralized location such as a database.

Upvotes: 0

Related Questions