Re: Are random writes optimized sequentially by Linux kernel?

From: david(at)lang(dot)hm
To: Dmitry Koterov <dmitry(at)koterov(dot)ru>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Are random writes optimized sequentially by Linux kernel?
Date: 2009-01-07 19:54:45
Message-ID: alpine.DEB.1.10.0901071152560.32030@asgard.lang.hm
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, 7 Jan 2009, Dmitry Koterov wrote:

> Hello.
>
> Suppose I perform 1000 RANDOM writes into a file. These writes are saved
> into Linux writeback buffer and are flushed to the disc asynchronously,
> that's OK.
>
> The question is: will physical writes be performed later in the sequence of
> physical SECTOR position on the disc (minimizing head seeking)? Or Linux
> background writer knows nothing about physical on-disc placement and flushes
> data in order it is saved in the RAM?
>
> E.g., if I write in the application:
>
> a) block 835
> b) block 136
> c) block 956
> d) block 549
> e) block 942
>
> dows the Linux background writer save flush them e.g. in physical order "136
> - 549 - 835 - 942 - 956" or not?

yes, the linux IO scheduler will combine and re-order write requests.

they may end up being done 835-942-956-549-136 if the system thinks the
head happens to be past 549 and moving up when the requests hit the IO
system.

David Lang

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Stefano Nichele 2009-01-07 21:02:05 Re: understanding postgres issues/bottlenecks
Previous Message Stefano Nichele 2009-01-07 19:05:43 Re: understanding postgres issues/bottlenecks