This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:
apport-collect 1785020 and then change the status of the bug to 'Confirmed'. If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'. This change has been made by an automated script, maintained by the Ubuntu Kernel Team. ** Changed in: linux (Ubuntu) Status: New => Incomplete ** Tags added: bionic -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/1785020 Title: fsync is slow on later kernels with ext4 filesystms Status in linux package in Ubuntu: Incomplete Bug description: So this is a simple one, if I run the following code (see below) on Ubuntu 18.04 (4.15.0-29-generic ) and against Ubuntu 16.04 ( 4.4.0-87-generic) I get two different results ; The question is why? It seems that fsync may be broken in the latest kernel and may well be broken as early as 4.10 ? This has huge implications around performance sensitive applications like mysql. It also so worth noting that I'm running this against an ext4 filesystem with the following mount options rw,noatime,nodiratime,nobarrier,data=journal 4.4.0-87-generic - # time ./fsync real 0m7.537s <----- user 0m0.000s sys 0m1.060s <----- 4.15.0-29-generic - # time ./fsync real 1m38.299s <----- user 0m0.013s sys 0m0.893s <----- Linux buntu-1804 4.15.0-29-generic no sync() seconds:0.024438 writes per second:0.000000 sync() seconds:1.705764 writes per second:0.000000 real 3m6.475s user 0m0.006s sys 0m1.725s Linux ubuntu 4.4.0-87-generic no sync() seconds:0.012887 writes per second:0.000001 sync() seconds:0.736563 writes per second:0.000000 real 0m8.945s user 0m0.016s sys 0m0.732s #!/usr/bin/python import os, sys, mmap # Open a file fd = os.open( "/a/testfile", os.O_RDWR|os.O_CREAT|os.O_DIRECT ) m = mmap.mmap(-1, 512) for i in range (1,10000): os.lseek(fd,os.SEEK_SET,0) m[1] = "1" os.write(fd, m) os.fsync(fd) # Close opened file os.close( fd ) #define _GNU_SOURCE #include <stdio.h> #include <fcntl.h> #include <time.h> #include <unistd.h> void withSync() { int f = open( "/a/t8" , O_RDWR | O_CREAT |O_DIRECT ); lseek (f, 0, SEEK_SET ); int records = 10*1000; clock_t ustart = clock(); for(int i = 0; i < records; i++) { write(f, "012345678901234567890123456789" , 30); fsync(f); } clock_t uend = clock(); close (f); printf(" sync() seconds:%lf writes per second:%lf\n", ((double)(uend-ustart))/(CLOCKS_PER_SEC), ((double)records)/((double)(uend-ustart))/(CLOCKS_PER_SEC)); } void withoutSync() { int f = open( "/a/t10" , O_RDWR | O_CREAT | O_DIRECT ); lseek (f, 0, SEEK_SET ); int records = 10*1000; clock_t ustart = clock(); for(int i = 0; i < records; i++) { write(f, "012345678901234567890123456789" , 30 ); } clock_t uend = clock(); close (f); printf("no sync() seconds:%lf writes per second:%lf \n", ((double)(uend-ustart))/(CLOCKS_PER_SEC), ((double)records)/((double)(uend-ustart))/(CLOCKS_PER_SEC)); } int main(int argc, const char * argv[]) { withoutSync(); withSync(); return 0; } Linux buntu-1804 4.15.0-29-generic no sync() seconds:0.024438 writes per second:0.000000 sync() seconds:1.705764 writes per second:0.000000 real 3m6.475s user 0m0.006s sys 0m1.725s Linux ubuntu 4.4.0-87-generic no sync() seconds:0.012887 writes per second:0.000001 sync() seconds:0.736563 writes per second:0.000000 real 0m8.945s user 0m0.016s sys 0m0.732s To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1785020/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp