Slow DB writes

Post Reply
Sanaki
Posts: 110
Joined: Wed Mar 09, 2011 1:30 am

Slow DB writes

Post by Sanaki »

While in general I understand tables can be used for most database functions, this isn't always feasible. However, after setting up a system which appeared to work fine, I ran into an issue with major slowdown whenever I had to do multiple updates in rapid succession. I just put it into a time tester, and 10 sets in a row of "fetch, update", over twenty tests, have an execution time of 0.86 seconds at -best-, reaching as high as 1.108 seconds on the worst. From what I can tell, this is because as opposed to a standard database, this is actually doing a file write on every update. Thing is, this lag is freezing the entire client during the delay, not just causing a delay in the connection or somesuch. Is there any way to load the file into RAM and have it only updated at a set interval or somesuch? Or alternatively, is this a behavior that can be fixed in a future version of Mudlet? I'd just move it to using the database I already have running on this computer, but that effectively destroys my ability to export it to other players.

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Slow DB writes

Post by Vadi »

It's not broken, it's your slow HDD. You can disable automatic writes to the disk, see "Transactions" section of the db manual, or get an SSD.

Sanaki
Posts: 110
Joined: Wed Mar 09, 2011 1:30 am

Re: Slow DB writes

Post by Sanaki »

Huh. Somehow hadn't thought about using transactions that way. Much appreciated! And for the record, I'd love an SSD. It's my wallet that's being all stingy on me.

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Slow DB writes

Post by Vadi »

Same :(

Yetzederixx
Posts: 186
Joined: Sun Nov 14, 2010 5:57 am

Re: Slow DB writes

Post by Yetzederixx »

Load your database contents into a table and do your work with that if possible, that's how I do it.

Sanaki
Posts: 110
Joined: Wed Mar 09, 2011 1:30 am

Re: Slow DB writes

Post by Sanaki »

If that were reasonable, there'd be no reason for me to keep the database usage for this at all. I'd just store it in a persistent table.

Sanaki
Posts: 110
Joined: Wed Mar 09, 2011 1:30 am

Re: Slow DB writes

Post by Sanaki »

Transactions fixed the problem quite nicely, zero slowdown now. And to think I believed I wouldn't have a use for them in Mudlet.

Post Reply