If (num_players 5000) Then ???? End If

Started by
3 comments, last by kynkreet 14 years, 4 months ago
Hi everybody. I want to create a multiplayer poker game, grouping players by tables. After reading all information I could, I think this is what has to be done: - Use Flash for the visuals, using XMLSockets to connect server. - Create a multithreading Java server, who creates a new Thread for each table. Assuming this is Ok, I wonder what will happen if I have too many players. How many threads do I need to handle 10.000 users? I don't think this is possible. And the most useful information I could get: How does big websites (as pokerstars) work? Thanks in advance (and sorry about my english).
Advertisement
Quote:Original post by wewaitandwewonder
How many threads do I need to handle 10.000 users?


You *need* one.

Quote:How does big websites (as pokerstars) work?


The "best" approach to this type of TCP-based applications is asynchronous networking. In Java it's available through NIO + thread pools.

Several developers of this type of servers have reported success using different platforms altogether, such as Erlang or Scala, perhaps even Clojure (if you want to stay on JVM), which offer better programming models for this type of applications.
An alternative to writing a java server is to use a php/mysql backend and do regular http requests to it from your flash.

IMO that should be able to handle more clients than a java server and MUCH easier to find hosting for. (:

You might also be able to tap into database replication and load balancing which already exist and work well for php/mysql so you don't have to architect such a huge system yourself.
Quote:An alternative to writing a java server is to use a php/mysql backend and do regular http requests to it from your flash.


This model is evil and must die. It is so wasteful on resources. It's only there because various service providers and corporations are too paranoid for their own good. There is exactly one case where this model is necessary: When a corporate firewall does not let any traffic through, and you have to go through a HTTP proxy, and that HTTP proxy does not support HTTP Upgrade. If you're in that environment, you probably shouldn't be playing poker, anyway :-D

Anyway, if you have 10,000 users, paying $100/month for a dedicated self-managed server with root access should be peanuts. (Or you could pay $400/month and get high-end hardware, even).

I second the suggestion to use asynchronous I/O and thread pools with one thread per hardware thread in the box. In Java, this means NIO. In C++, you can get this through boost::asio. In C#, you can get this with BeginRead()/EndRead() on a TcpSocket. Assuming you do nothing stupid, and use async I/O, 10,000 users should be possible on a modern quad-core or dual-quad-core machine; something like this. I'd recommend putting whatever persistent database you use on a second machine with less CPU, but RAID for the actual storage, and connecting to that from the game hosting machine.

enum Bool { True, False, FileNotFound };
Hi,

for the kind of project you are starting, I recommend you to check the smartfox solution here .

With this one, You can use flash for client, and java for the server side. And it is able to support 10000+ players per server.

There is a free version for you to test, but it can quickly become an expensive solution in my opinion.

Hope this helps.

This topic is closed to new replies.

Advertisement