Should I run sync in background for ufs2?

Hi.

I add this to crontab:
Code:
*/1 * * * * /bin/sync;/bin/sync;/bin/sync

I think this would help me do less fsck.

And why does the system disable by default:
Code:
kern.sync_on_panic
 
You really shouldn't bother with the sync's, you are hamstringing your performance. As for the sync_on_panic option, I'm guessing we don't have it on since there is a concern that at panic, there is corrupt data that you don't want to flush to disk. Better to live with what's already there than make things worse.

My question is why are you trying to do this? Are you ending up running fsck a lot as it is?
 
gordon@ said:
You really shouldn't bother with the sync's, you are hamstringing your performance. As for the sync_on_panic option, I'm guessing we don't have it on since there is a concern that at panic, there is corrupt data that you don't want to flush to disk. Better to live with what's already there than make things worse.

My question is why are you trying to do this? Are you ending up running fsck a lot as it is?

My web server is running MySQL on FreeBSD 7.3 . I thought the sync command would release some static file cache memory, and flush data to disk, because I want more memory for my web applications. I don't run sync from crontab now, I just wonder it would be helpful or not!

And I need sync_on_panic, MySQL causes big IO on disk, if the OS just crashes during that time, the database filesystem (ufs2) would always be destroyed! So I want to sync data to disk. and I don't want to do fsck on such a big filesystem.
 
My web server is running mysql on freebsd 7.3 . I thought the sync command would release some static file cache memory, and flush data to disk, becuase I want more memory for my web applications. I don't run sync on crontab now, I just wonder it would be helpful or not!

In FreeBSD, or in fact any BSD (and probably also any other OS), in events of memory pressure not-actively used memory will be paged out in order to obtain free pages for a process in need of more memory. The way dirty cache pages are paged out is what you call flushing - i.e. write cache pages into the "files" they belong to, and use them for something else afterwards.

If you only synchronize the cache it's dirty contents are written to disk, but the cache pages will remain cache pages (that now need to be marked clean), so it's contents can be reused when the next process attemps to read the just-written file.

And I need sync_on_panic, mysql cause big IO on disk, if the OS just crash that time, the database filesystem(ufs2) always be destroyed! So I want to sync data to disk. and I don't want to do fsck on such a big filesystem.
Background fsck?
If you want to expend less memory for cache pages, reduce the vm.v_cache_min and vm.v_cache_max sysctl(8) tunables (the numbers are multiples of 4KiBytes for x86/amd64) which control the amout of file cache you want FreeBSD to maintain.
While most probably not the solution to your problem it's certainly a better workaround then the cron-sync, as it doesn't spike the writes every n units of time.
 
Back
Top