List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:January 14 2000 3:02pm
Subject:Open file descriptors
View as plain text  
>>>>> "Matthias" == Matthias Urlichs <smurf@stripped> writes:

Matthias> Imagine 100 clients, each continuously running a complex query on
Matthias> five tables.

Matthias> That requires 605 file descriptors (because each thread opens the data
Matthias> file separately). I assume this is because mysql needs a different seek
Matthias> position for each data file, which makes sense.

Matthias> However, on recent systems there exist pread()/pwrite() calls, which
Matthias> read/write a specific place in a file without changing the seek position.
Matthias> Thus, you'd only need 110 file descriptors.

Matthias> Does 3.23 already do that? If so, I didn't find it in the documentation,
Matthias> which explicitly says

MySQL uses pread/pwrite at a lot of places but not everywhere. The
problem is mainly that if we only do pread/pwrite and we do this on
the same file, we have to add a mutex around this and this will slow
things a lot on OS that doesn't have pread/pwrite.

Matthias> +A table is opened for each concurrent access. This means that
Matthias> +if you have two threads accessing the same table or access the table
Matthias> +twice in the same query (with @code{AS}) the table needs to be opened
> twice.

Matthias> which either is out-of-date, or should be fixed.

I spoked about this with some Linux developers at the O'Reilly
convention in Monterey a couple of months ago and they claimed that on
Linux 2.3 opening additional file descriptors will not slow down
anything (except the open of course) and claim so little extra
resources that the above optimization isn't worth it (at least not on
Linux).

After the above discussion we put the option to use fewer file
descriptors a little lower on our TODO.

Regards,
Monty
Thread
Open file descriptorsMatthias Urlichs14 Jan
  • Open file descriptorsMichael Widenius14 Jan
    • Re: Open file descriptorsMatthias Urlichs15 Jan