Killing CPU

This is not a Support area! Discuss about the Server here. Non-Server related discussion goes in Off-Topic Discussion.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Julian
L2j Veteran
L2j Veteran
Posts: 25
Joined: Mon May 15, 2006 1:31 pm

Re: Killing CPU

Post by Julian »

LOL, i'm having big fun reading this :)

Anyways, yes, Nbd`s server is far away from original L2J core, but not that really far. Most of ideas behind his servers is what we discused team wide. I prefer to think about Nbd`s server more like experimental ground where we test most of our vast ideas, ideas where we cant put directly into L2J, becouse of very hazardos code that it contains. Some of us (me) have access to Nbd`s private svn and if we find some piece of code that we like and thing will be good, we take it. So, i dont see why other ppls are interested of some1 else private data!

So, have fun blaming each other :)
User avatar
Pere
Posts: 400
Joined: Sat Jan 05, 2008 11:09 am
Location: Catalunya, Berguedà

Re: Killing CPU

Post by Pere »

Julian wrote:Nbd`s private svn
How do you update l2j revs, then? One by one, looking at the trac? So it's impossible to have folders with more than 1 repository...
(I want my own svn too :P)
Bones tardes amics meus tots!
User avatar
qwerty13
Posts: 640
Joined: Mon Feb 02, 2009 9:57 am
Location: Europe
Contact:

Re: Killing CPU

Post by qwerty13 »

migi-chan wrote:
Julian wrote:Nbd`s private svn
How do you update l2j revs, then? One by one, looking at the trac? So it's impossible to have folders with more than 1 repository...
(I want my own svn too :P)
Feel free in http://assembla.com/ :mrgreen:
rockkth
Posts: 196
Joined: Sat Jul 04, 2009 8:54 am

Re: Killing CPU

Post by rockkth »

i have a strange problem too.

i just updated my system with +1 gb ram and a brand new much faster hdd and installed win 64.

after few hours (3,4) my java process starts to spike the cpu from 10,30-50 and the game becomes laggy.

now, with the old win 32 i could run the game for days without any cpu spike. the cpu stayed at 1-6 and no in game lag.

i`m running version = 3230 on both systems.

any ideas?

PS: i havent modified any server configs or any other files whatsoever.
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: Killing CPU

Post by janiii »

rockkth wrote:i have a strange problem too.

i just updated my system with +1 gb ram and a brand new much faster hdd and installed win 64.

after few hours (3,4) my java process starts to spike the cpu from 10,30-50 and the game becomes laggy.

now, with the old win 32 i could run the game for days without any cpu spike. the cpu stayed at 1-6 and no in game lag.

i`m running version = 3230 on both systems.

any ideas?

PS: i havent modified any server configs or any other files whatsoever.
run the server with telnet enabled and paste here the debug info from telnet during that cpu pike.
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
rockkth
Posts: 196
Joined: Sat Jul 04, 2009 8:54 am

Re: Killing CPU

Post by rockkth »

ok, the problem was the alocated memory. Seams 64 bit os needs much more ram...at least at the settings. Also i reduced the threads , i put to the threads in general settings the values 2 everywhere, as suggested in other topics, since i have 2 cores...

Alltho java never passes 924 MB now with the settings bellow, there were no more incidents , he s not eating cpu, the cpu is 1-3 % most of the time and no lag in game.

Still, i don`t understand the way it works, i mean, how can i set so java eats as much ram as indeed? if i have 7Gb for exemple, how can i set java to eat 6 gb if he needs too?

---------
i have 3 GB ram , but java uses max 950 (after 12 hours) alltho i editet gameserver to use 2gb instad of defaul 1024 (wich was working great on windows 32 xp)..i rly dont understand.

when i got home java was constantly using 50% of my procesor and in the gameserver console there was an error saying java didnt had enough memory...

now i change the default gamserver . sh settingslike below and seams ok...still i dont understand why it eats only 924 mb of ram

Code: Select all

#!/bin/bash # exit codes of GameServer:#  0 normal shutdown#  2 reboot attempt while :; do	[ -f log/java0.log.0 ] && mv log/java0.log.0 "log/`date +%Y-%m-%d_%H-%M-%S`_java.log"	[ -f log/stdout.log ] && mv log/stdout.log "log/`date +%Y-%m-%d_%H-%M-%S`_stdout.log"	java -Xms2048m -Xmx2048m -cp ./../libs/*:l2jserver.jar net.sf.l2j.gameserver.GameServer > log/stdout.log 2>&1	[ $? -ne 2 ] && break#	/etc/init.d/mysql restart	sleep 10done 
PS: After 16 hours it occured again. The java app had 955 MB in use only, and the CPU was waving between values 1-25-50 every 5 seconds. No errors in game consoles , but lag in game was occuring exactly when the cpu starts to vary it s value...


seams windows 64 suckz. back to 32 untill i find some better solution on google.

sry javii, i dont have a clue how to use telnet, and my server is live dont want it to slow it down...
kotk
Posts: 99
Joined: Wed Jan 04, 2006 12:51 am

Re: Killing CPU

Post by kotk »

rockkth, why you posting a bash script if you are running Windows? If that is what you edited, could be the problem.
lishawj
Posts: 253
Joined: Thu Apr 30, 2009 12:29 am

Re: Killing CPU

Post by lishawj »

It has been years but I believe this is how a 32bit Windows system work. A 32bit OS can address only 2GB for the kernel. Let's say that you have a 4GB Windows 2003 Server running in 32bit mode. Out of that 4GB, 2GB goes to kernel and the other 2GB goes to application. All applications have to share the same 2GB kernel address space. This means that after you load up Windows and all related services in addition to all applications (MySQL, and the L2J server), your 2GB kernel address space might be around 1GB left. I believe this 1GB address space is what is left for Java to work with and with you tweaking the startup variables, it could very well goof it up.

I am also running my L2J server on a 32bit Windows Server 2003 RC2. For testing purposes, I had been running the server with "Java -server" for a week now without explicitly modifying xmx and xmn variables. Yes, the server will fail to load if I start specifying those variables. Again, this is simply for testing purposes.
rockkth
Posts: 196
Joined: Sat Jul 04, 2009 8:54 am

Re: Killing CPU

Post by rockkth »

lishawj wrote:It has been years but I believe this is how a 32bit Windows system work. A 32bit OS can address only 2GB for the kernel. Let's say that you have a 4GB Windows 2003 Server running in 32bit mode. Out of that 4GB, 2GB goes to kernel and the other 2GB goes to application. All applications have to share the same 2GB kernel address space. This means that after you load up Windows and all related services in addition to all applications (MySQL, and the L2J server), your 2GB kernel address space might be around 1GB left. I believe this 1GB address space is what is left for Java to work with and with you tweaking the startup variables, it could very well goof it up.

I am also running my L2J server on a 32bit Windows Server 2003 RC2. For testing purposes, I had been running the server with "Java -server" for a week now without explicitly modifying xmx and xmn variables. Yes, the server will fail to load if I start specifying those variables. Again, this is simply for testing purposes.
i was running windows 64 when i said the java application doesent grow larger then 855 mb , alltho i have free physical memory 1.5 gb , besides kernel +other processes. that s why i edited the script, so java could use more ram, but id doesent.

anyways, today i was thinking, what can be the issue. The only thing different in win 64 then win 32 is JAVA 64 bit. I think that 64 bit java isnt optimized well, or l2j isnt optimized for 64 bit java. Except java, nothing is different, ofc besides the 64bit brand new installed windows.

see, it s exactly oposite. in windows 32 bit , the server never has any issues with default settings. TOday it runed flawlessly all day, i got home java eats 722 mb, no lag, no processor issues (12 hours passed).

with windows 64 bit, same settings, gameserver, hardware, after 16 hours the processor waves.

you might ask yourself why i `m posting this, it s because many users had encountered this same problem too, and i searched google for days now without any valid solution.

i will try tomorow morning to run java 32 bit on win 64 and see if the problem persists. if anybody has allready a solution, i d appreciate it. there are many really smart people here.
rockkth
Posts: 196
Joined: Sat Jul 04, 2009 8:54 am

Re: Killing CPU

Post by rockkth »

kotk wrote:rockkth, why you posting a bash script if you are running Windows? If that is what you edited, could be the problem.
that is the GameServer_loop.sh , i read on this forum that that is how u can increase the amount of RAM java uses for l2j gamserver...
User avatar
DrHouse
L2j Inner Circle
L2j Inner Circle
Posts: 912
Joined: Mon Jan 22, 2007 12:14 am
Location: Spain

Re: Killing CPU

Post by DrHouse »

That's only true for linux, since on windows you use it for nothing.

Go to startGameServer.bat and edit it in the same way ;)
Image

Leadership and management are not talk and talk, but talk and do

Proud of being a part of this project
rockkth
Posts: 196
Joined: Sat Jul 04, 2009 8:54 am

Re: Killing CPU

Post by rockkth »

DrHouse wrote:That's only true for linux, since on windows you use it for nothing.

Go to startGameServer.bat and edit it in the same way ;)
god damn, thank u man :)).

just one, possibly stupid question ,still ,

also i found this info
rem Make sure -Xmn value is always 1/4 the size of -Xms and -Xmx.
rem -Xms and -Xmx should always be equal.
rem 2GB: -Xmn256m -Xms1024m -Xmx1024m
so , if i set xms/xmx to 2048 / xmn 512, that s 2 GB of ram,that means java will grow max to 2GB? i `m just wondering why it doesnet behave like any other application, and just grows and uses even the slower pagefile if needed, instead of giving errors and maybe overusing the cpu (i`ll see if that was the problem after probabil the next 24 hrs, but sadly i doubt it and still don`t understand why the hack the server lags if the cpu waves to MAX 50%, not 100%..it shouldnt be a problem at 50...i guess)

----

also, what happends when it reaches max? many times i had on win 32 1200 mb used, more then the max 1024 in the gameserver.bin xmn/xms . Do people get disconeccted when the memory is almost full, as in (IO/ERROR user xxx disconected by the software in your machine)?

also there is the mythical theadpool. on many topics here, some mod wrote that the threadpool values should be a number equal to your proc/core numbers in your system. that means if you have a dual core you should put for exemple 2 to those values.

still, if this explanation is right (and i tried it, works ok with 2) , then why is the default values have such values as 13/4/8 and so on? wouldnt it make sense the default beeing the smalles core number possible, eg: 2 for safety reasons?

something just doesent add up.

this is my thread config,my test systembeeing a dual core 3800(2100)windsor amd 64 with 3gb

Code: Select all

# Default: 10ThreadPoolSizeEffects = 10 # Default: 13ThreadPoolSizeGeneral = 13 # Default: 2UrgentPacketThreadCoreSize = 2 # Default: 4GeneralPacketThreadCoreSize = 4 # Default: 4GeneralThreadCoreSize = 4 # Default: 6AiMaxThread = 6
from wiki
The cost of having a larger thread pool is increased resource usage. The algorithm used to determine when to create or destroy threads will have an impact on the overall performance:

* create too many threads, and resources are wasted and time also wasted creating any unused threads
* destroy too many threads and more time will be spent later creating them again
* creating threads too slowly might result in poor client performance (long wait times)
* destroying threads too slowly may starve other processes of resources
[img]
http://en.wikipedia.org/wiki/File:Thread_pool.svg[/img]

so, having a lower number would mean increased performance, no matter the server... but what are the benefits of having a higher number of threads?
Typically, there are many more tasks than threads. As soon as a thread completes its task, it will request the next task from the queue until all tasks have been completed. The thread can then terminate, or sleep until there are new tasks available.
maybe having the ability to run much more tasks at once...but i`m guessing here, i didnt notice no difference between setting all values abow to 2 instead of the default values wich are much higher..

so again, would it be advised to push the sytem limit by putting higher numbers? the real question is IT IS WORTH IT , practically , for l2j server? is there something to gain?

can`t find good info about this,just people guessing without actually knowing what are they tuning, practically.
rockkth
Posts: 196
Joined: Sat Jul 04, 2009 8:54 am

Re: Killing CPU

Post by rockkth »

Sun's 64-bit Java virtual machines are slower to start up than their 32-bit virtual machines because Sun has only implemented the "server" JIT compiler (C2) for 64-bit platforms.[10] The "client" JIT compiler (C1), which produces less efficient code but compiles much faster, is unavailable on 64-bit platforms.

Speed is not the only factor to consider in a comparison of 32-bit and 64-bit processors. Applications such as multi-tasking, stress testing, and clustering—for HPC (high-performance computing)—may be more suited to a 64-bit architecture given the correct deployment. 64-bit clusters have been widely deployed in large organizations such as IBM, HP and Microsoft, for this reason.
so java on 64 bit is slower then 32 ony at startup?! kinda unclear..., might that be the reason of fluctuation..

also
The main disadvantage of 64-bit architectures is that relative to 32-bit architectures the same data occupies more space in memory (due to swollen pointers and possibly other types and alignment padding). This increases the memory requirements of a given process and can have implications for efficient processor cache utilization.
rockkth
Posts: 196
Joined: Sat Jul 04, 2009 8:54 am

Re: Killing CPU

Post by rockkth »

solution: increase the memory ram java uses under win xp 64.
User avatar
LaraCroft
Posts: 360
Joined: Sat Aug 08, 2009 1:37 am

Re: Killing CPU

Post by LaraCroft »

Good topic....
:mrgreen:
!!!knowledge and intelligence must be shared!!!
Post Reply