-File Channel performance and fsync
Jagadish Bihani 2012-10-22, 11:48
I am writing this on top of another thread where there was discussion on
"fsync lies" and
only file channel used fsync and not file sink. :
-- I tested the fsync performance on 2 machines (On 1 machine I was
getting very good throughput
using file channel and on another almost 100 times slower with almost
same hardware configuration.)
using following code
#define PAGESIZE 4096
int main(int argc, char *argv)
char *read_filename= argv;
readfd = open(read_filename,O_RDONLY);
writefd = open("written_file",O_WRONLY|O_CREAT,777);
int iterations = len/PAGESIZE;
struct timeval t0,t1;
long elapsed = (t1.tv_sec-t0.tv_sec)*1000000 +
printf("Elapsed time is= %ld \n",elapsed);
-- As expected it requires typically 50000 microseconds for fsync to
complete on one machine and 200 microseconds
on another machine it took 290 microseconds to complete on an average.
So is machine with higher
performance is doing a 'fsync lie'?
-- If I have understood it clearly; "fsync lie" means the data is not
actually written to disk and it is in
some disk/controller buffer. I) Now if disk loses power due to some
shutdown or any other disaster, data will
be lost. II) Can data be lost even without it ? (e.g. if it is keeping
data in some disk buffer and if fsync is being
invoked continuously then will that data can also be lost? If only part
-I is true; then it can be acceptable
because probability of shutdown is usually less in production
environment. But if even II is true then there is a
-- But on the machine where disk doesn't lie performance of flume using
File channel is very low (I have seen it
maximum 100 KB/sec even with sufficient DirectMemory allocation.) Does
anybody have stats about throughput
of file channel ? Is anybody getting better performance with file
channel (without fsync lies). What is the recommended
usage of it for an average scenario ? (Transferring files of few MBs to
HDFS sink continuously on typical hardware
(16 core processors, 16 GB RAM etc.)
On 10/10/2012 11:30 PM, Brock Noland wrote:
> On Wed, Oct 10, 2012 at 11:22 AM, Jagadish Bihani
> <[EMAIL PROTECTED]> wrote:
>> Hi Brock
>> I will surely look into 'fsync lies'.
>> But as per my experiments I think "file channel" is causing the issue.
>> Because on those 2 machines (one with higher throughput and other with
>> I did following experiment:
>> cat Source -memory channel - file sink.
>> Now with this setup I got same throughput on both the machines. (around 3
>> Now as I have used "File sink" it should also do "fsync" at some point of
>> 'File Sink' and 'File Channel' both do disk writes.
>> So if there is differences in disk behaviour then even in the 'File Sink' it
>> should be visible.
>> Am I missing something here?
> File sink does not call fsync.
>> On 10/10/2012 09:35 PM, Brock Noland wrote:
>>> OK your disk that is giving you 40KB/second is telling you the truth
>>> and the faster disk is lying to you. Look up "fsync lies" to see what
>>> I am referring to.
>>> A spinning disk can do 100 fsync operations per second (this is done
>>> at the end of every batch). That is how I estimated your event size,
>>> 40KB/second is doing 40KB / 100 = 409 bytes.
>>> Once again, if you want increased performance, you should increase the
Denny Ye 2012-10-22, 13:38
Jagadish Bihani 2012-10-23, 06:31
Juhani Connolly 2012-10-23, 07:08
Jagadish Bihani 2012-10-22, 13:18
Brock Noland 2012-10-22, 13:59
Brock Noland 2012-10-22, 14:29
Jagadish Bihani 2012-10-23, 06:40
Juhani Connolly 2012-10-23, 07:26