Re: performance: use pread instead of lseek+read
От | Manfred Spraul |
---|---|
Тема | Re: performance: use pread instead of lseek+read |
Дата | |
Msg-id | 3E67A65C.7070206@colorfullife.com обсуждение исходный текст |
Ответ на | Re: performance: use pread instead of lseek+read (Bruce Momjian <pgman@candle.pha.pa.us>) |
Ответы |
Re: performance: use pread instead of lseek+read
|
Список | pgsql-patches |
Bruce Momjian wrote: >BSD/OS doesn't have pread either. Isn't pread() just a case of merging >two system calls into one? Does a single system call cause that much >overhead? I didn't think so. > > As I wrote, in a microbenchmark lseek+read(,8192) was 10% slower than pread(,,8192). >Doesn't pread() do the lseek() internally anyway. > No. pread doesn't use the file pointer at all. This is a huge advantage if fds are shared: Two threads/processes can read simultaneously from the same fd. This is impossible without pread - there is only one file pointer, the threads would trash each others state. Since postgresql doesn't share fds, the only advantage for postgresql is the lower syscall overhead. >> >> >>>- which benchmark would be interesting? >>> >>> >>Something that measures the performance "in context", that is as part of >>normal database activity, not just the syscall overhead. pgbench is >>notoriously hard to get reproducible numbers out of, but you could try >>it if you like. >> >> I'll try that. -- Manfred
В списке pgsql-patches по дате отправления: