Is it a good idea? If I need data that multiple users can access, but is only going to be temporary and stored for maybe 2 minutes, is XML a good choice?
The reason I'm not using the database is that it gets quite messy and I hear it can result in significant slowdown if there are many users acessing and updating the same data at once. Also the fact that XML is well structured and (relatively) easy to access and work with if a factor here.
Any feedback is appreciated.
Using XML as temporary storage
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Using XML as temporary storage
Databases are designed to do what you want and are probably the first choice. I can't imagine that it will be "quite messy" to use a database. And I don't think that XML will be that efficient (which itself is considered messy, verbose, etc.). And ff you are writing while others are reading you will need to implement locking (which databases do implicitly).Animatro wrote:The reason I'm not using the database is that it gets quite messy and I hear it can result in significant slowdown if there are many users acessing and updating the same data at once.
(#10850)
Re: Using XML as temporary storage
Messing around with files and file locks will almost certainly be slower than using a database. And you will have to code for race conditions that databases already handle.
You could try an in-memory database storage engine. MySQL for example has a MEMORY engine. It will be faster than a MyISAM engine, but will sit in RAM so you don't want permanent data in there.
You could try an in-memory database storage engine. MySQL for example has a MEMORY engine. It will be faster than a MyISAM engine, but will sit in RAM so you don't want permanent data in there.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Using XML as temporary storage
heh...what? Why would a database be messy?
It honestly shouldn't matter what storage type you use, the fear of caching (by itself) being messy is what bugs many developers, because it usually means implementing code in areas where it doesn't feel right, but is to much work to implement else where, so a hack ensues and the code is thus messy (something of a cross cutting concern).
Ultimately though, a DB will probably manage the process more efficiently than XML, if you want real performance, use a cache sub-system that stores temporary data in RAM not on the file system.
XML is best at storing structured/hierarchial data which it excels at (also being more portable and easily editable) otherwise I would think a DB should win every other time.
Cheers,
Alex
It honestly shouldn't matter what storage type you use, the fear of caching (by itself) being messy is what bugs many developers, because it usually means implementing code in areas where it doesn't feel right, but is to much work to implement else where, so a hack ensues and the code is thus messy (something of a cross cutting concern).
Ultimately though, a DB will probably manage the process more efficiently than XML, if you want real performance, use a cache sub-system that stores temporary data in RAM not on the file system.
XML is best at storing structured/hierarchial data which it excels at (also being more portable and easily editable) otherwise I would think a DB should win every other time.
Cheers,
Alex