[Techtalk] mySql or saving files to disk, which is faster?

Wim De Smet kromagg at gmail.com
Sat May 26 15:38:13 UTC 2007


On 5/26/07, Mr. Hardy <tech-talk at htpad.com> wrote:
> Hello everyone,
> I have a little problem and I would like your opinion before I continue.
> I am writing a game server script.
> clients will connect directly to the server at my website.
> my website host has a Unix/Linux system.
>
> thousands of clients could potentially connect at once.
> each group of ten clients would be using the same database table or flat file for game state.
>
> which would be faster:
> -using mySql database tables or...
> -using flat files which I will load and save from directories at my website.

I guess it depends on the type of data you're saving (highly
structured data more easily goes into a database) and the type of
stuff you want to do with it. If you have a directory with hundreds of
flat files, backing it up or indexing the directory they're stored in
will likely take a long time. To access one of the files you'd need to
know the direct mapping of client->file, otherwise indexing the entire
directory then assigning a file would take a while, especially if the
file contains data necessary for assigning the correct file.

If you store stuff in a database I'm not sure whether separate tables
would be a good idea. If this is a performance optimization then you'd
normally opt for the database to handle the details, maybe define an
index or two yourself. Most likely it'll be faster than when you try
to partition the data yourself.

hth,
Wim


More information about the Techtalk mailing list