Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (762)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (847)
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 3274 times)
0 Members and 1 Guest are viewing this topic.
Offline selimeki

Senior Newbie





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

Hey,
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?
Sincerely

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
Administrator

« JGO Overlord »


Medals: 1341
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: 182



« 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  
 
 

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

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

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

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

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

nelsongames (857 views)
2018-04-24 18:14:32

ivj94 (1319 views)
2018-03-24 14:47:39

ivj94 (437 views)
2018-03-24 14:46:31

ivj94 (1100 views)
2018-03-24 14:43:53

Solater (449 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
java-gaming.org 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‑gaming.org
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!