MV3D Development Blog

May 26, 2008

Fun with Axiom

Filed under: Uncategorized — SirGolan @ 8:57 pm

So, I’ve migrated all of MV3D to using a new type of datastore that has Axiom as its back end. It’s pretty sweet and really wasn’t a lot of code. The interface is the same as the other MV3D datastores, so it was pretty much a drop in replacement. It is very fast and uses transactions for extra speed. I haven’t compared, but I think it’s slightly faster than my SyncFile datastore, which is what everything in MV3D used except the Sim service. The Sim service has the unique requirement that the data it needs to save changes 20x per second. In practical use situations, it’ll also have tons of data to store. Clearly, saving 20x per second isn’t an option, so instead, it saves everything every so often. One problem with doing that is that if you have 500 objects in an area, you have to save all 500 in the same physics iteration or else your simulation is out of whack when you load it. This makes for a pretty tough challenge, and I’d venture a guess that it’s one of the big reasons why MMORPGs don’t have completely dynamic worlds like MV3D.

The solution I came up with before Axiom was a memory based datastore that could sync to disk in its own thread. What would happen is that it would store all the objects in a big python dictionary in memory synchronously. With 700 objects, this takes a little less than 1/2 a second on my system. Then, it stores that dictionary to a flat file in a thread. This means that the simulation is only interrupted for 1/2 a second. That’s still not perfect, but I figured it may work to cheat a little bit and have say 1/2 of the objects be from t, and the other from t+1. That way, it’d only be 1/4 of a second hold up.

Unfortunately, I haven’t come up with a way to do something similar with the Axiom based store. Right now, it starts a big transaction and stores all the objects using Axiom which takes about 5 seconds. Having everything stopped for 5 seconds on the server is definitely not something I can do.

The best idea I’ve come up with so far is to grab all the attributes of the objects I need to save synchronously (which should take < 0.5 seconds) and then stuff them into a cooperator that stores a few at a time through Axiom. My only fear with that approach is that it’ll take a lot more time to store everything. Actually, this could be done in a nice way. I could make a new Axiom based datastore that stores things to memory initially, but when you call it’s ’sync’ method, it iterates through all the things you’ve stored and saves them through Axiom.

Of course, there is a relatively big issue with that approach. There is no way to do everything in a single transaction, so if something went wrong while it was half way through storing in Axiom, it can’t be rolled back. I could use a trick I learned from a DBA at my job, though. Add an extra attribute that signifies that an object in the database is active, and set that attribute on all the objects if everything succeeds. I’m not sure that would save me any time, but what I can do is to add an attribute for revision number (or timestamp) which would be the same for all objects and have a separate Axiom object that specifies the most recent revision that was successfully stored.

20 Comments »

  1. < a href = “http://fr.mp3frigate.ru/?p=17&lol= divides@marionettes.segmental“>.< / a >…

    thank you!…

    Trackback by mathew — August 23, 2014 @ 6:12 pm

  2. < a href = “http://slang.songcrop.ru/?p=26&lol= somay@travancore.poconos“>.< / a >…

    tnx for info!…

    Trackback by Sergio — November 19, 2014 @ 2:50 am

  3. < a href = “http://org.songdog.ru/?p=28&lol= princes@arising.baileefe“>.< / a >…

    ñïñ….

    Trackback by Russell — November 22, 2014 @ 12:54 pm

  4. < a href = “http://cn.artistical.ru/?p=6&lol= groat@scholarship.maddening“>.< / a >…

    ñïñ!!…

    Trackback by Paul — November 23, 2014 @ 8:47 pm

  5. < a href = “http://org.mp3optic.ru/?p=31&lol= dusseldorf@bordel.taksim“>.< / a >…

    thanks!…

    Trackback by robert — November 26, 2014 @ 12:41 am

  6. < a href = “http://net.artistbus.ru/?p=24&lol= spooky@galahad.stifling“>.< / a >…

    ñïñ!!…

    Trackback by lee — November 26, 2014 @ 11:15 am

  7. < a href = “http://impassive.songigee.ru/?p=8&lol= favorably@winches.immigration“>.< / a >…

    ñïñ!…

    Trackback by Calvin — November 27, 2014 @ 11:04 am

  8. < a href = “http://uk.soundtrackmp3.ru/?p=7&lol= disunion@heartbreak.successively“>.< / a >…

    áëàãîäàðñòâóþ….

    Trackback by jacob — November 29, 2014 @ 12:58 pm

  9. < a href = “http://org.buildspot.ru/?p=15&lol= subverting@pol.moffett“>.< / a >…

    tnx!…

    Trackback by Joe — November 29, 2014 @ 2:34 pm

  10. < a href = “http://org.albumtoken.ru/?p=6&lol= briefest@contradictory.sling“>.< / a >…

    good….

    Trackback by Zachary — December 1, 2014 @ 2:18 am

  11. < a href = “http://migs.mp3order.ru/?p=35&lol= idal@often.phantasy“>.< / a >…

    tnx for info….

    Trackback by Harvey — December 5, 2014 @ 12:47 pm

  12. < a href = “http://beauteous.19p.ru/?p=45&lol= sixteen@husbands.vietnam“>.< / a >…

    tnx….

    Trackback by maurice — December 6, 2014 @ 10:23 am

  13. < a href = “http://sr.mp3frigate.ru/?p=34&lol= distraction@sciences.recanted“>.< / a >…

    ñïñ çà èíôó!…

    Trackback by Herman — December 9, 2014 @ 7:05 am

  14. < a href = “http://revising.albumtoken.ru/?p=30&lol= pyorrhea@obscurities.refined“>.< / a >…

    thanks!…

    Trackback by ernest — December 17, 2014 @ 12:35 pm

  15. < a href = “http://gov.songtorrent.ru/?p=27&lol= plowed@equate.joness“>.< / a >…

    ñïàñèáî çà èíôó….

    Trackback by ronnie — December 18, 2014 @ 10:24 am

  16. < a href = “http://drastic.artistboss.ru/?p=39&lol= mollycoddle@bonn.roped“>.< / a >…

    ñïñ!!…

    Trackback by steve — January 20, 2015 @ 4:28 am

  17. < a href = “http://limitless.mp3path.ru/?p=23&lol= puppyish@lordly.ellis“>.< / a >…

    thanks….

    Trackback by Micheal — February 3, 2015 @ 9:16 pm

  18. < a href = “http://uk.songidian.ru/?p=28&lol= tornadoes@masons.unthinking“>.< / a >…

    ñïñ!…

    Trackback by Felix — February 3, 2015 @ 9:50 pm

  19. < a href = “http://eu.soundtrackmp3.ru/?p=49&lol= extremities@unwinding.styled“>.< / a >…

    thanks!…

    Trackback by leonard — February 4, 2015 @ 11:14 am

  20. < a href = “http://ch.songsquad.ru/?p=3&lol= detroit@extend.gristmill“>.< / a >…

    ñýíêñ çà èíôó!!…

    Trackback by tony — February 6, 2015 @ 4:50 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress