An idea to increase server performance

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
Post Reply
Nik
L2j Veteran
L2j Veteran
Posts: 629
Joined: Fri Apr 18, 2008 9:09 pm

An idea to increase server performance

Post by Nik »

Well, lately i've been having some issues, server freezing for 4-5 seconds every 5 minutes, when many players are online. I tried to investigate it... and from the results i saw, i thought that its caused by the character updates, no wonder, it opens a new connection and executes a query ~900 times, lol, no wonder why.
Making a new connection, sending a query so many times at once, this is major performance loss. So my idea is to generate 1 major string, containing updates of every character online. This will MAJORLY increase the performance, because the server will open 1 connection and execute 1 query, instead of oppening multiple connections and executing multiple queries.
And this idea will be suitable for every simlar thing, where you have to execute multiple queries.

What do you think about this guys?
Playing a game where you know how every single mechanism works is quite satisfying.
Its the main perk that a gamer-developer has :D
User avatar
JIV
L2j Veteran
L2j Veteran
Posts: 1882
Joined: Sun Jan 06, 2008 8:17 pm
Location: Slovakia
Contact:

Re: An idea to increase server performance

Post by JIV »

default is 15min and its not executed for all chars at same time.
Vapulabe
Posts: 271
Joined: Wed Mar 19, 2008 10:16 am

Re: An idea to increase server performance

Post by Vapulabe »

What takes the most time is not opening the connection (connection pooling and such) nor sending the SQL request...

What takes the most time is the execution of the SQL request on the SQL server...

Creating a bigger request will only concentrate the time needed... what could help is the opposite...

Try to optimize your SQL server... Or, if you feel good enough, you may also try to switch to PostgreSQL with full request optimisation (most of the requests are similar so the "genetic engine" will be able to get quite accurate).
User avatar
MELERIX
L2j Veteran
L2j Veteran
Posts: 6667
Joined: Sat Sep 23, 2006 11:31 pm
Location: Chile
Contact:

Re: An idea to increase server performance

Post by MELERIX »

nik wrote:Well, lately i've been having some issues, server freezing for 4-5 seconds every 5 minutes, when many players are online. I tried to investigate it... and from the results i saw, i thought that its caused by the character updates, no wonder, it opens a new connection and executes a query ~900 times, lol, no wonder why.
Making a new connection, sending a query so many times at once, this is major performance loss. So my idea is to generate 1 major string, containing updates of every character online. This will MAJORLY increase the performance, because the server will open 1 connection and execute 1 query, instead of oppening multiple connections and executing multiple queries.
And this idea will be suitable for every simlar thing, where you have to execute multiple queries.

What do you think about this guys?
viewtopic.php?f=80&t=15414
Nik
L2j Veteran
L2j Veteran
Posts: 629
Joined: Fri Apr 18, 2008 9:09 pm

Re: An idea to increase server performance

Post by Nik »

Ehh, its my fault that i was too hasty for posting this thing, without looking the sourcecode a bit to see that it doesnt update all chars at once... the reason i thought that it could be the char store thingie is because the problem occurs every 5 min, and the update interval is 5 min aswell.
Creating a bigger request will only concentrate the time needed... what could help is the opposite...
Create an SQL file that adds 500 NPCs for example. First time, try to make every NPC to have its own query, the second time, make all the NPCs to be in 1 query, and look what will be executed faster

Well, the SQL server is optimized, but maybe not good enough :|
Playing a game where you know how every single mechanism works is quite satisfying.
Its the main perk that a gamer-developer has :D
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: An idea to increase server performance

Post by janiii »

nik wrote:Ehh, its my fault that i was too hasty for posting this thing, without looking the sourcecode a bit to see that it doesnt update all chars at once... the reason i thought that it could be the char store thingie is because the problem occurs every 5 min, and the update interval is 5 min aswell.
Creating a bigger request will only concentrate the time needed... what could help is the opposite...
Create an SQL file that adds 500 NPCs for example. First time, try to make every NPC to have its own query, the second time, make all the NPCs to be in 1 query, and look what will be executed faster

Well, the SQL server is optimized, but maybe not good enough :|
check java PreparedStatement . is for batch sql statements.
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
Vapulabe
Posts: 271
Joined: Wed Mar 19, 2008 10:16 am

Re: An idea to increase server performance

Post by Vapulabe »

nik wrote:
Creating a bigger request will only concentrate the time needed... what could help is the opposite...
Create an SQL file that adds 500 NPCs for example. First time, try to make every NPC to have its own query, the second time, make all the NPCs to be in 1 query, and look what will be executed faster
Now, try to do some update and the situation change... Because updating a table means file write, index update, ...

You are talking about the time when the server updates... this is not a SELECT...

Also, doing select on player data is only done one account at a time, when the player connects on that player... It's a rather small and quick request...

Big DB hogs are
- Spawn load from SQL (once at startup ?)
- Mass UPDATE on the DB (well, SELECT/UPDATE/INSERT way of doing it is even worse)
User avatar
Szponiasty
Advanced User
Advanced User
Posts: 557
Joined: Mon Apr 21, 2008 1:31 pm
Location: Eastern Poland

Re: An idea to increase server performance

Post by Szponiasty »

Not to mention that default databases are not optimized too well. And you can easyly make for example few indexes and db power utilisation drops down greately.
Post Reply