writting becomes slow after few writes

1

1

I am running an embedded Linux on arm with a SD-Card. While writing huge amounts of data I see bizarre effects. E.g, when I dd a 15 MB file few times, it writes the file (normally) in less than 2 Secs. But After lets say 3-4 times it takes sometimes 15 to 30 Seconds to write the same file. If I sync after writing the file, then this does not happen but sync takes long time too. If there is enough gap between writing two files than presumably kernel syncs itself. How can I optimize the whole performance so that write should always finish inside 2 Seconds. The File system I am using is ext3. Any pointers?

user1566277

Posted 2012-10-23T10:40:16.267

Reputation: 11

Is using another filesystem (ext2) an option? – Bobby – 2012-10-23T12:46:41.383

yes I can try that. Do you think it can improve performance because its not a JFS? – user1566277 – 2012-10-23T13:13:35.157

changed to ext2. It's the same. – user1566277 – 2012-10-23T13:34:01.897

1In that case I'd guess that it is due to a cache. Your data is not really writting onto the card but is instead cached somewhere and then get's asynchronously written to the card. You could try to mount it via mount -o sync CARD MOUNTPOINT. – Bobby – 2012-10-23T13:46:36.940

Thank you Bobby for your answer. I mounted it now using sync option on ext2, now the same data takes more than 30 seconds to be written. – user1566277 – 2012-10-23T14:03:29.950

2Well, then it is the cache which makes it appear faster the first few times. Get a faster SD-Card reader then would be the only answer. – Bobby – 2012-10-23T14:05:38.560

Can I tell kernel somehow to sync after every 2 MB or so, rather than after whole write operation? – user1566277 – 2012-10-23T14:17:55.273

That will not really change something, as it already does with the sync option. The sync option forces the data to be directly written to the device, if you have a constant stream of data that's the speed you get with it. – Bobby – 2012-10-23T14:23:30.370

No answers