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?
An idea to increase server performance
Forum rules
READ NOW: L2j Forums Rules of Conduct
READ NOW: L2j Forums Rules of Conduct
-
- L2j Veteran
- Posts: 629
- Joined: Fri Apr 18, 2008 9:09 pm
An idea to increase server performance
Playing a game where you know how every single mechanism works is quite satisfying.
Its the main perk that a gamer-developer has
Its the main perk that a gamer-developer has

- JIV
- L2j Veteran
- Posts: 1882
- Joined: Sun Jan 06, 2008 8:17 pm
- Location: Slovakia
- Contact:
Re: An idea to increase server performance
default is 15min and its not executed for all chars at same time.
-
- Posts: 271
- Joined: Wed Mar 19, 2008 10:16 am
Re: An idea to increase server performance
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).
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).
- MELERIX
- L2j Veteran
- Posts: 6667
- Joined: Sat Sep 23, 2006 11:31 pm
- Location: Chile
- Contact:
Re: An idea to increase server performance
viewtopic.php?f=80&t=15414nik 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?
-
- L2j Veteran
- Posts: 629
- Joined: Fri Apr 18, 2008 9:09 pm
Re: An idea to increase server performance
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.
Well, the SQL server is optimized, but maybe not good enough
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 fasterCreating a bigger request will only concentrate the time needed... what could help is the opposite...
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
Its the main perk that a gamer-developer has

- janiii
- L2j Veteran
- Posts: 4269
- Joined: Wed May 28, 2008 3:15 pm
- Location: Slovakia
Re: An idea to increase server performance
check java PreparedStatement . is for batch sql statements.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.
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 fasterCreating a bigger request will only concentrate the time needed... what could help is the opposite...
Well, the SQL server is optimized, but maybe not good enough
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper ♀
I don't give private support - PM will be ignored!
forum flOOder dancing dEVILoper ♀
I don't give private support - PM will be ignored!
-
- Posts: 271
- Joined: Wed Mar 19, 2008 10:16 am
Re: An idea to increase server performance
Now, try to do some update and the situation change... Because updating a table means file write, index update, ...nik wrote: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 fasterCreating a bigger request will only concentrate the time needed... what could help is the opposite...
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)
- Szponiasty
- Advanced User
- Posts: 557
- Joined: Mon Apr 21, 2008 1:31 pm
- Location: Eastern Poland
Re: An idea to increase server performance
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.