Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (788)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (860)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Estimating threads and connection of a server  (Read 3481 times)
0 Members and 1 Guest are viewing this topic.
Offline selimeki

Senior Newbie

« Posted 2007-03-11 13:10:47 »

I'm on a project which is about a board game. How can I approximately calculate max threads and max connections that the server can handle? Is there any way except waiting the server to throw any exception?

PS: The server sends all the clients a message about who joined a table or who quit one, and messages about the moves of the clients to a table (there are 4 players playing on a table)
Offline Jackal von ÖRF

Junior Devvie

« Reply #1 - Posted 2007-03-11 20:38:11 »

How can I approximately calculate max threads and max connections that the server can handle?
Stress test the server by creating lots of dummy clients which send data to the server (about the same way as normal players would), and see how many clients the server can handle. Measure memory usage, CPU usage and response times during the test. Then you'll have an estimation.

If you find that you need more speed, use a Java profiler for finding the bottlenecks in your code.

Since you talked about "calculating max threads that the server can handle", I got to wondering that what kind of a threading architecture do you use? If you have one thread for each game or client, it will greatly lower the performance of the server, because of the time required by thread context changes. It is faster to have only a few threads (ideally one per CPU core) which handle lots of clients.

Offline selimeki

Senior Newbie

« Reply #2 - Posted 2007-03-11 21:22:41 »

I planned to use a thread per client. The server is a dual core machine. Wouldn't it be a problem if thousands of clients send messages to one thread?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline CaptainJester

JGO Knight

Medals: 12
Projects: 2
Exp: 14 years

Make it work; make it better.

« Reply #3 - Posted 2007-03-12 11:27:36 »

If you use the java.nio package for networking, you don't need to use any threads at all.

Offline SluX

Junior Devvie

« Reply #4 - Posted 2007-03-12 13:48:23 »

Well, that is not entirely correct. If there are a lot of users connected, threading will be necessary in order to even the response times....

"Intelligence is the most beautiful gift and the greatest temptation which one life can receive from the gods."Me Cheesy
Play strategic football
Offline Riven

« JGO Overlord »

Medals: 1357
Projects: 4
Exp: 16 years

Hand over your head.

« Reply #5 - Posted 2007-03-12 14:00:58 »

Well, that is not entirely correct. If there are a lot of users connected, threading will be necessary in order to even the response times....

What can 2 thread what 1 thread can't?

IO never blocks, so the CPU can run at 100% handling incoming and outgoing
packets. With non-blocking IO in 1 thread, your response-times will be exactly
the same, if not better, as you don't have to synchronize.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline cylab

JGO Kernel

Medals: 194

« Reply #6 - Posted 2007-03-12 14:37:12 »

I don't know if I miss something, but I think this statement is only true for similar requests or requests of the same duration. If you have different "commands" and some of them take a large amount of time, using just one thread will block the processing of the shorter commands while the time consuming ones are executed.

Mathias - I Know What [you] Did Last Summer!
Pages: [1]
  ignore  |  Print  

hadezbladez (2109 views)
2018-11-16 13:46:03

hadezbladez (804 views)
2018-11-16 13:41:33

hadezbladez (2080 views)
2018-11-16 13:35:35

hadezbladez (415 views)
2018-11-16 13:32:03

EgonOlsen (3448 views)
2018-06-10 19:43:48

EgonOlsen (3677 views)
2018-06-10 19:43:44

EgonOlsen (2272 views)
2018-06-10 19:43:20

DesertCoockie (3002 views)
2018-05-13 18:23:11

nelsongames (3072 views)
2018-04-24 18:15:36

nelsongames (3852 views)
2018-04-24 18:14:32
Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!