View previous topic :: View next topic |
Author |
Message |
chris421
Joined: 07 Apr 2005 Posts: 53
|
Posted: Fri Dec 29, 2006 19:54 Post subject: 2DA to MySQL migration yields 350+ avg improvement |
|
|
Uploaded my ERF, my performance results, and my sql script for migrating NWN2's 2DA files to MySQL here.
My initial comments about achieving a 10-12 fold improvement over the standard Get2DAString didn't factor the overhead I incurred while spamming SpeakStrings to verify the resulting data. Removing the SpeakStrings showed the true throughput appears between 150-160 microseconds per look-up. This is in comparison to the standard Get2DAString throughput of 23-76 milliseconds. Note: my test server is only running PC3200 DDR. So greater throughput should be possible.
Not sure what can be said for my method vs. the performance/stability of in-game in-memory cached hashsets on objects. And if Obsidian currently is caching their 2DA.zip by default, they appear to be doing a horrible job of it. One clear advantage of moving 2DAs to MySQL though is absolute flexibility. |
|
Back to top |
|
|
chris421
Joined: 07 Apr 2005 Posts: 53
|
Posted: Sat May 19, 2007 6:54 Post subject: Potential performance issue with NWNX4 1.08 |
|
|
Well whatever was done to improve/increase the 2DA cache in NWN2 1.05 sure smokes my old NWNX4 / MySQL method.
The odd runs are 200 MySQL lookups, compared with the even runs, 200 native Obsidian Get2DAString's.
What I can't figure out is why my lookups got so much worse? The xp_time.dll changed, went from MySQL 5.0.27 to .41, the game obviously changed. Could NWNX4 1.08 have gotten this much slower?
NWN2 1.05 with NWNX4 1.08
Quote: |
1
Starting timer QUERY_TIMER19
Stopping timer QUERY_TIMER19: 912936 µs / 912.936 msec / 0.913 sec
2
Starting timer QUERY_TIMER19
Stopping timer QUERY_TIMER19: 41998 µs / 41.998 msec / 0.042 sec
3
Starting timer QUERY_TIMER19
Stopping timer QUERY_TIMER19: 718453 µs / 718.453 msec / 0.718 sec
4
Starting timer QUERY_TIMER19
Stopping timer QUERY_TIMER19: 42528 µs / 42.528 msec / 0.043 sec
5
Starting timer QUERY_TIMER19
Stopping timer QUERY_TIMER19: 411339 µs / 411.339 msec / 0.411 sec
6
Starting timer QUERY_TIMER19
Stopping timer QUERY_TIMER19: 17850 µs / 17.850 msec / 0.018 sec |
NWN2 1.03 with NWNX4 1.07
Quote: |
1
Starting timer QUERY_TIMER8
Stopping timer QUERY_TIMER8: 29789 µs / 29.789 msec / 0.030 sec
2
Starting timer QUERY_TIMER8
Stopping timer QUERY_TIMER8: 15292001 µs / 15292.001 msec / 15.292 sec
3
Starting timer QUERY_TIMER8
Stopping timer QUERY_TIMER8: 32564 µs / 32.564 msec / 0.033 sec
4
Starting timer QUERY_TIMER8
Stopping timer QUERY_TIMER8: 13045891 µs / 13045.891 msec / 13.046 sec
5
Starting timer QUERY_TIMER8
Stopping timer QUERY_TIMER8: 29942 µs / 29.942 msec / 0.030 sec
6
Starting timer QUERY_TIMER8
Stopping timer QUERY_TIMER8: 4568399 µs / 4568.399 msec / 4.568 sec |
|
|
Back to top |
|
|
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Sun May 20, 2007 0:29 Post subject: Re: Potential performance issue with NWNX4 1.08 |
|
|
chris421 wrote: | Well whatever was done to improve/increase the 2DA cache in NWN2 1.05 sure smokes my old NWNX4 / MySQL method.
The odd runs are 200 MySQL lookups, compared with the even runs, 200 native Obsidian Get2DAString's.
What I can't figure out is why my lookups got so much worse? The xp_time.dll changed, went from MySQL 5.0.27 to .41, the game obviously changed. Could NWNX4 1.08 have gotten this much slower?
|
Read your numbers again...
1.08 sequence - ALL sub-second
1.07 sequence - 15,13 & 4 second results.
Basically NWN2 caches all the 2DA's (but only on request) rather than only the last two 2DA's accessed.
Cheers
Gryphyn |
|
Back to top |
|
|
chris421
Joined: 07 Apr 2005 Posts: 53
|
Posted: Sun May 20, 2007 3:47 Post subject: Re: Potential performance issue with NWNX4 1.08 |
|
|
Gryphyn wrote: |
Read your numbers again...
1.08 sequence - ALL sub-second
1.07 sequence - 15,13 & 4 second results.
|
Read my own numbers?
1,3,5 = MySQL plugin
2,4,6 = native Obsidian Get2DAString
Focus on the two sets of 1,3,5. Ignore 2,4,6. While 2,4,6 are improved--that's due to Obsidian. The 1,3,5 performance got substantially slower in NWNX4 1.08.
I recompiled Pap's code and now all the MySQL lookups dropped to 50msec. Still not as quick as they were under NWNX4 1.07, but no 900+msec either. |
|
Back to top |
|
|
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Sun May 20, 2007 13:38 Post subject: Re: Potential performance issue with NWNX4 1.08 |
|
|
chris421 wrote: | Gryphyn wrote: |
Read your numbers again...
1.08 sequence - ALL sub-second
1.07 sequence - 15,13 & 4 second results.
|
Read my own numbers?
1,3,5 = MySQL plugin
2,4,6 = native Obsidian Get2DAString
Focus on the two sets of 1,3,5. Ignore 2,4,6. While 2,4,6 are improved--that's due to Obsidian. The 1,3,5 performance got substantially slower in NWNX4 1.08.
I recompiled Pap's code and now all the MySQL lookups dropped to 50msec. Still not as quick as they were under NWNX4 1.07, but no 900+msec either. |
Ahh. Didn't read the Odd/Even sets into your numbers.
Cheers
Gryphyn |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Fri Jun 08, 2007 9:26 Post subject: |
|
|
I wonder what your MySQL queries look like. 200 lookups with a duration of around 700 ms seems rather slow.
You should be able to do 200 lookups in about 3.5 ms, not 700! (cf. this thread). What could be the reason for this ? _________________ Papillon |
|
Back to top |
|
|
Grinning Fool
Joined: 12 Feb 2005 Posts: 264
|
Posted: Fri Jan 18, 2008 18:44 Post subject: |
|
|
I know this is an old topic, but I was wondering if anyone has re-run these tests since early 2007, when Obsidian added 2da caching to the engine? I'd expect to see a slow load the first time, and a much faster one for subsequent reads.
If not... perhaps it's worth exploring a Get2DAString hook that uses DB or local hash, thus giving benefit to internal 2da use? _________________ Khalidine, a NWN2 persistent world
Looking for volunteers. |
|
Back to top |
|
|
FunkySwerve
Joined: 02 Jun 2005 Posts: 377
|
Posted: Fri Jan 18, 2008 21:08 Post subject: |
|
|
I recently ran a bunch of tests posted on the bioboards comparing locals to 2das, which should prove informative. Given that Biowareeans posted asking questions in that thread, in which I basically said Get2daString was unuseable for practical applications, I suspect it was the reason they improved its caching in 1.69. Any tests comparing them should be run against that beta, since I would expect to see dramatically improved performance with the additional caching capability.
[Edit]
Oh, I should also mention that we use the hash plugin for storing much of the data in OldManWhistler's spells data setup, and for storing data for our item updater. It's nice and speedy, as well, and iirc I ran some compares against it. I'll try to hunt down the thread.
Funky |
|
Back to top |
|
|
Mithon
Joined: 20 Jun 2007 Posts: 4 Location: Norway
|
Posted: Sat Jan 19, 2008 19:01 Post subject: |
|
|
I'd also be very interrested in seeing those results.. I would love to know what the local vs db vs 2da lookup times on current versions of nwnx4 and nwn2 are. |
|
Back to top |
|
|
FunkySwerve
Joined: 02 Jun 2005 Posts: 377
|
|
Back to top |
|
|
|