logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
2DA to MySQL migration yields 350+ avg improvement

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related
View previous topic :: View next topic  
Author Message
chris421



Joined: 07 Apr 2005
Posts: 53

PostPosted: Fri Dec 29, 2006 19:54    Post subject: 2DA to MySQL migration yields 350+ avg improvement Reply with quote

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
View user's profile Send private message
chris421



Joined: 07 Apr 2005
Posts: 53

PostPosted: Sat May 19, 2007 6:54    Post subject: Potential performance issue with NWNX4 1.08 Reply with quote

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
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Sun May 20, 2007 0:29    Post subject: Re: Potential performance issue with NWNX4 1.08 Reply with quote

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
View user's profile Send private message
chris421



Joined: 07 Apr 2005
Posts: 53

PostPosted: Sun May 20, 2007 3:47    Post subject: Re: Potential performance issue with NWNX4 1.08 Reply with quote

Gryphyn wrote:

Read your numbers again...
1.08 sequence - ALL sub-second
1.07 sequence - 15,13 & 4 second results.


Read my own numbers? Confused

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
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Sun May 20, 2007 13:38    Post subject: Re: Potential performance issue with NWNX4 1.08 Reply with quote

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? Confused

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
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Fri Jun 08, 2007 9:26    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Fri Jan 18, 2008 18:44    Post subject: Reply with quote

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
View user's profile Send private message
FunkySwerve



Joined: 02 Jun 2005
Posts: 377

PostPosted: Fri Jan 18, 2008 21:08    Post subject: Reply with quote

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
View user's profile Send private message
Mithon



Joined: 20 Jun 2007
Posts: 4
Location: Norway

PostPosted: Sat Jan 19, 2008 19:01    Post subject: Reply with quote

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
View user's profile Send private message
FunkySwerve



Joined: 02 Jun 2005
Posts: 377

PostPosted: Tue Jan 22, 2008 13:57    Post subject: Reply with quote

http://nwn.bioware.com/forums/viewtopic.html?topic=566175&forum=47&sp=0


Figures aplenty. Sorry, this had slipped from my mind.

Funky
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group