lovecc0923 / aionxemu

Automatically exported from code.google.com/p/aionxemu
0 stars 2 forks source link

Cracy resources with Java ... lots of context switches... need to implement ThreadPool #283

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
YOU MUST BE USING AION X EMU FILES ONLY!! IF ANY MODIFICATIONS WERE DONE TO
THE FILES THAT WERE NOT INCLUDED WITH THE SVN, WE WILL NOT SUPPORT THOSE
ISSUES HERE!!

Core revision: svn-257

Bug description:
The java code doesn use ThreadPool library so it consumes a lot of context 
switches and the machine can't proccess anything, the procesor only change 
between context switches.

I found a patch at AionUnique that solves the problem:
http://www.aion-unique.org/viewtopic.php?f=8&t=1472
Attached the patch.
Can you apply it to the SVN branch?

Thank you.

What steps will reproduce the problem?:
Run the GameServer.

What is the expected output?:
The CPU process data, not only context switches.

Please copy/paste errors below:

The line blue represents the context switches. When I stop the aion server it 
goes down, when I start (without users) the gameserver it goes to the infinite 
(> 200.000 context switches)
http://server.zone-limit.com/munin/zone-limit/gserver.zone-limit/interrupts.html

Original issue reported on code.google.com by pablo.ca...@gmail.com on 16 Apr 2011 at 12:26

Attachments:

GoogleCodeExporter commented 9 years ago
How you mess the context switches?

Original comment by Aions...@gmail.com on 18 Apr 2011 at 1:25

GoogleCodeExporter commented 9 years ago
The graphs are created by munin.
But you can use vmstat. For example "vmstat 1 1000" then start aion and you 
could watch the context switches (cs column) grow to the infinite.....

Original comment by pablo.ca...@gmail.com on 18 Apr 2011 at 6:11

GoogleCodeExporter commented 9 years ago
Without users connected to the server:

root@gserver ~ # vmstat 1 10000
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 3  0  18056 1210528 114088 2143088    0    0     9    51    2    2  3  1 95  1
 1  0  18056 1210272 114088 2143096    0    0     0    20 7818 103278  5  3 91  0
13  0  18056 1210272 114104 2143104    0    0     0   116 8158 105838  6  3 91  
1
 8  0  18056 1210272 114104 2143120    0    0     0     0 7770 104173  6  3 91  0
 0  0  18056 1210396 114104 2143128    0    0     0    68 8220 104503  6  3 91  0
 1  0  18056 1210392 114108 2143140    0    0     0   980 8827 102768  5  3 86  5
 2  0  18056 1210396 114108 2143176    0    0     0     8 7679 105093  5  3 92  0
 0  0  18056 1210768 114108 2143188    0    0     0     0 7822 106119  6  3 91  0
 8  0  18056 1210768 114120 2143188    0    0     0   816 7717 104609  5  3 92  0
 2  0  18056 1210752 114128 2143228    0    0     0   216 7633 102036  5  3 92  0
[...]

When I stop aion:

root@gserver ~ # killall -9 java
root@gserver ~ # vmstat 1 10000
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 0  0  17708 3039904 115584 2154668    0    0     9    51    2    1  3  1 95  1
 0  0  17708 3039740 115592 2154688    0    0     0   180 2641 3199  4  1 96  0
 0  0  17708 3042468 115600 2154716    0    0     4   164 2338 2866  3  1 97  0
 0  0  17708 3042500 115600 2154740    0    0     0     8 2346 3469  3  1 97  0
 0  0  17708 3042632 115620 2154772    0    0     0   820 2405 3579  2  1 96  0
 0  0  17708 3042616 115624 2154796    0    0     0    96 2220 3215  3  1 97  0
 0  0  17708 3044408 115624 2154888    0    0    48   372 2833 4213  3  1 94  2

And when aion restarted:
root@gserver ~ # vmstat 1 10000
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 3  0  17700 2261168 117592 2325144    0    0     9    51    2    2  3  1 95  1
 3  0  17700 2155060 117592 2325164    0    0     0     8 5219 4953 15  1 84  0
 3  0  17700 2158664 117596 2325196    0    0     0   324 6583 15730 14  1 84  0
 3  0  17700 2158424 117600 2325208    0    0     0   160 7805 22885 15  2 84  0
 3  0  17700 2091588 117600 2325244    0    0     0     0 7733 46517 13  3 84  0
 8  0  17700 1859376 117604 2325272    0    0     0   192 6973 46989 13  3 84  0
 1  0  17700 1579012 117624 2325316    0    0     0  1640 5413 4952 14  2 79  5
 1  0  17700 1578888 117628 2325340    0    0     0    88 5216 3571 16  1 83  0
 2  0  17700 1533480 117632 2325428    0    0    12  3528 8432 64283 11  3 82  3
 3  0  17700 1533280 117640 2325688    0    0     4  7212 11058 111000  8  5 82  5
 1  1  17696 1533272 117644 2325908    0    0     0  7148 10749 113089  7  5 80  8
 5  0  17692 1533024 117644 2326020    0    0     0   876 8193 105655 12  3 84  0
 3  0  17692 1533784 117644 2326052    0    0     0     0 8174 110043 12  3 84  0
 4  0  17692 1533768 117644 2326084    0    0     0    84 8469 112380 13  3 84  0
 5  0  17692 1533400 117648 2326116    0    0     0   680 8326 102006 12  3 84  0
 3  0  17692 1533000 117652 2326140    0    0     0   104 7911 104404 13  3 84  0
 2  0  17692 1532892 117672 2326144    0    0     0   648 8197 106676 13  3 83  1
 2  1  17692 1532396 117676 2326180    0    0     0  1524 8249 106915 13  3 83  0
 2  0  17692 1527444 117696 2326376    0    0     4  1660 8383 109247 13  3 82  1
 3  0  17692 1526816 117700 2326412    0    0     0   224 8135 101427 13  3 84  0
 3  0  17692 1527692 117700 2326440    0    0     0   120 8505 112556 13  3 83  0
 1  0  17692 1487376 117704 2326464    0    0     0   112 6493 53304 14  2 84  0
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 1  0  17692 1487252 117704 2326492    0    0     0    36 5244 3800 15  1 84  0
 0  0  17692 1404116 117712 2326528    0    0     4   396 6236 52607 12  3 85  1
 0  0  17692 1404116 117712 2326544    0    0     0     0 7524 101645  5  3 92  0
 0  0  17692 1403992 117712 2326572    0    0     0    12 7429 99944  5  3 92  0
 0  0  17692 1403744 117712 2326596    0    0     0   356 7583 100631  5  3 91  1
 4  2  17692 1403116 117720 2326628    0    0     0   540 7868 101347  5  3 90  1
 1  0  17692 1402728 117740 2326668    0    0     0  1196 7438 99342  5  3 77 15
 5  0  17692 1402348 117744 2326696    0    0     0   276 7477 96381  5  4 91  0
10  0  17692 1402176 117748 2326740    0    0     0   400 7537 102194  5  4 91  
0
 1  0  17692 1402812 117748 2326764    0    0     0     0 7746 99332  5  4 92  0
 7  0  17692 1402780 117756 2326788    0    0     0   124 7477 100909  5  4 91  0
[...]

root@gserver ~ # ps aux | grep java
root     27663  4.9  1.2 384944 105760 ?       Sl   08:58   0:03 java -Xms32m 
-Xmx64m -ea -Xbootclasspath/p:./libs/jsr166.jar -cp ./libs/*:ax-login-1.0.1.jar 
loginserver.LoginServer
root     27681 65.7 17.0 2445244 1396496 ?     Sl   08:58   0:51 java -server 
-Xms1024m -Xmx2048m -ea -Xbootclasspath/p:./libs/jsr166.jar -cp 
./libs/*:ax-game-1.0.1.jar gameserver.GameServer

http://stackoverflow.com/questions/3543155/servers-and-threading-models

You need more info about it?

Original comment by pablo.ca...@gmail.com on 18 Apr 2011 at 7:02

GoogleCodeExporter commented 9 years ago
Yeah, AXE consumes resourses as hell

Original comment by wildsisop@gmail.com on 19 Apr 2011 at 5:49

GoogleCodeExporter commented 9 years ago

Original comment by ZeroSign...@gmail.com on 19 Apr 2011 at 5:16

GoogleCodeExporter commented 9 years ago
Aion Unique's Forums Closed, do you have that Patch still?

Original comment by ZeroSign...@gmail.com on 27 Apr 2011 at 12:38

GoogleCodeExporter commented 9 years ago
The patch is attached in the first comment.

Original comment by pablo.ca...@gmail.com on 27 Apr 2011 at 6:19

GoogleCodeExporter commented 9 years ago
ok give me some time, and I'll work on integrating it.

Original comment by ZeroSign...@gmail.com on 27 Apr 2011 at 11:27

GoogleCodeExporter commented 9 years ago
Please apply patch, test and report results.

Note - I have only added the Task Manager Pool but the only function that 
should be using it is PacketBroadCaster.trySendPacket().

I will leave it up to the developers to use a more appropriate ThreadQueue and 
where to use the scheduleTaskManager.

Original comment by ZeroSign...@gmail.com on 28 Apr 2011 at 5:57

Attachments:

GoogleCodeExporter commented 9 years ago
for moment hasta lowered a bit the resources and works great :)

could u continue to apply the rest and commit it :D

thkx :D

Original comment by ovidio88...@gmail.com on 4 May 2011 at 7:43

GoogleCodeExporter commented 9 years ago
Works fine. Ovidio and I work together with the same aionxemu ;P

Original comment by pablo.ca...@gmail.com on 5 May 2011 at 8:01

GoogleCodeExporter commented 9 years ago
Which patch are we supposed to use? I used Zero's patch and it has some sort of 
error. It doesn't display it, but if you apply patch you will see in the 
console.

 Write 0 Ip: xxx.xxx.xxx.xxx 

But it will constantly write the ip over and over. I looked in the log and the 
patch caused the write ip to write it about over 1-2 thousand times. By doing 
so it lagged the server badly. I reverted back to original and it works 
perfectly. If I apply the v2 patch will it do the same thing?

Thanks for the patches, but they are definitely not ready to commit.

Original comment by sky...@gmail.com on 5 May 2011 at 8:33

GoogleCodeExporter commented 9 years ago
My patch needs adjustment by someone who has better idea of the issue.

Original comment by ZeroSign...@gmail.com on 8 Jun 2011 at 11:16