|
You last visited: Today at 14:59
Advertisement
Optimizing to use less CPU?
Discussion on Optimizing to use less CPU? within the CO2 Private Server forum part of the Conquer Online 2 category.
10/17/2011, 01:50
|
#16
|
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
|
Quote:
Originally Posted by pro4never
Use a form of thread safe collection such as concurrent dictionary.
(was debated at great lengths in another thread while everyone /facepalmed at people's refusal to upgrade to newer versions of .net)
|
That thread was a joke.
|
|
|
10/20/2011, 11:55
|
#17
|
elite*gold: 0
Join Date: Jul 2007
Posts: 200
Received Thanks: 31
|
Try to build multiple threading, 1st threading handles the database and the second threading handles characters, if you can pull it off your server will run with around 3 CPU most of the time, when a character disconnects make sure it dumps the character thread otherwise the cpu will rise.
Edit:
Also go into program.cs, Event_Handler and try to remove the catch, try's because this also rises your CPU.
Also another thing you can do, is make a partition on your :C Drive and store your database there, it helps load your database faster if its on its own drive, and causes less lag.
CPU is the brain of a computer it handles what does what, ram is the speed of the computer
The better your CPU the faster it handles obviously better CPU is better performance on the other hand speed is essencial too.
|
|
|
10/20/2011, 12:00
|
#18
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Dont go down the route of 1 thread per character, it was abandoned quite early on because your server really suffers when it starts to get a large number of players online.
|
|
|
10/20/2011, 12:08
|
#19
|
elite*gold: 0
Join Date: Jul 2007
Posts: 200
Received Thanks: 31
|
Quote:
Originally Posted by Korvacs
Dont go down the route of 1 thread per character, it was abandoned quite early on because your server really suffers when it starts to get a large number of players online.
|
Thats because they dont know how to dump threads when a character disconnect figure that out like Impluse did and your laffing, on the other hand would you answer my post
|
|
|
10/20/2011, 12:23
|
#20
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Quote:
Originally Posted by sonofskeletor
Thats because they dont know how to dump threads when a character disconnect figure that out like Impluse did and your laffing, on the other hand would you answer my post 
|
No its because when you get 250 people online you have 250 active threads where a handful/a threadpool would do the same job.
|
|
|
10/20/2011, 12:25
|
#21
|
elite*gold: 0
Join Date: Jul 2007
Posts: 200
Received Thanks: 31
|
Agreed but who said anything about single threading for individual characters
I said 2 threads, 1st thread handles the database, mob spawns etc
2nd thread handles the whole character database.
|
|
|
10/20/2011, 13:12
|
#22
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Quote:
Originally Posted by sonofskeletor
when a character disconnects make sure it dumps the character thread otherwise the cpu will rise.
|
Quote:
Originally Posted by Korvacs
Dont go down the route of 1 thread per character, it was abandoned quite early on because your server really suffers when it starts to get a large number of players online.
|
Quote:
Originally Posted by sonofskeletor
Thats because they dont know how to dump threads when a character disconnect figure that out like Impluse did and your laffing, on the other hand would you answer my post 
|
You did...
|
|
|
10/20/2011, 13:28
|
#23
|
elite*gold: 0
Join Date: Jul 2007
Posts: 200
Received Thanks: 31
|
When i said dump character thread i meant, disconnect the character from the server, and im not here for a debate i came to give advice.
|
|
|
10/20/2011, 13:34
|
#24
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
..Ok well they are entirely different and seperate things, a character class or structure uses up memory, not CPU, your right that the character should be disconnected from the server and provided that is done then the GC will remove the character object provided its no longer being referenced, which should be the case if the disconnection is handled correctly.
But that has nothing to do with threads.
A thread could be compared to a road, things move along/through it and are handled depending on their circumstance, a class/struct/object could be likened to a vehicle that travels along that road and exits at various points depending on their circumstance.
This is a weak analogy since its just a generalisation of threads, but you get the general idea.
|
|
|
10/20/2011, 13:38
|
#25
|
elite*gold: 0
Join Date: Feb 2007
Posts: 340
Received Thanks: 38
|
I don't use 1 thread per character...i use 2 threads to handle character effects (sit, xp ko, buffs) and 2 threads to handle attacks (for all characters online).
Using 1 thread per character when a large amount of players are online will indeed make CPU go crazy as Korvacs said...anyway the most important thing that makes the CPU stressed are drops (searching in database items) and mobs searching for a target (I managed to reduce this as much as possible).
Even so...I'll make a few tests with stopwatch to see what threads take the most amount of time to run.
|
|
|
10/20/2011, 14:11
|
#26
|
elite*gold: 0
Join Date: Jul 2007
Posts: 200
Received Thanks: 31
|
This is a very good resource to use, you can moniter threads and close threads and **** with it,
|
|
|
10/20/2011, 14:32
|
#27
|
elite*gold: 0
Join Date: Feb 2007
Posts: 340
Received Thanks: 38
|
Hmm I will test that one too and see what it does.
|
|
|
All times are GMT +1. The time now is 14:59.
|
|