Skip to contentSkip to conversation

Reiser4 performance bottlenecks and possible solutions

DISCUSSION Xu CanHao 1 participant 2 messages Jul 20, 2007 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Xu CanHao

author
#1 lore raw

Hello!

I suspect your problem of "syncing for minutes" might be:

1, Not having a mount option "noatime,nodiratime"
2, Application sync/fsync/O_SYNC... too much
3, Memory size >>>> Disk write speed(what atom_max_size matters)

You may add the mount option yourself, the patch(for "reiser4-for-2.6.21.patch.gz") added a mount option "fsync" as said before(the default value is 100):

"Terrible fsync() performance has been talked for a thousand times without a full solution. I'm thinking of a temporary solution: adding a mount option and let the user determine the fsync() frequency(yes, you may lose data when power-fail), things like:
you may use "#mount /dev/sda1 /mnt/tmp -o fsync=10" which means "fsync once when invoked fsync 10 times""

The "atom_max_size" mount option seemed useless, so the only way is modify the source code and re-compile. The patch modified the default value of 1/4 mem_size to 1/8 mem_size which means if your HDD performs a 30MB/s in "hdparm -t" and your RAM is 512MB, you would have theoretically maximum 2 seconds waiting for atoms writing to disk(change the value as you wish).

At last, if you're paranoid enough for performance, use "formatting=extents" when mkfs.reiser4. Although tailing saves 5%-10% space, you gain more performance from do_sync_read().

Thanks!

2007/7/20, Adrian Glaubitz <[email protected]>:

Quoted 11 lines

Hello,

I found your posting on gmane about improvement for the reiser4-code to overcome some performance bottlenecks. I'm using reiser4 for my root-partiotion on my laptop and the disk is occasionally very busy with syncing for minutes. So, if possible, can you send me your patches to test them ?

Adrian

author
#2 lore raw

Hello!

I suspect your problem of "syncing for minutes" might be:

1, Not having a mount option "noatime,nodiratime"
2, Application sync/fsync/O_SYNC... too much
3, Memory size >>>> Disk write speed(what atom_max_size matters)

You may add the mount option yourself, the patch(for "reiser4-for-2.6.21.patch.gz") added a mount option "fsync" as said before(the default value is 100):

"Terrible fsync() performance has been talked for a thousand times without a full solution. I'm thinking of a temporary solution: adding a mount option and let the user determine the fsync() frequency(yes, you may lose data when power-fail), things like:
you may use "#mount /dev/sda1 /mnt/tmp -o fsync=10" which means "fsync once when invoked fsync 10 times""

The "atom_max_size" mount option seemed useless, so the only way is modify the source code and re-compile. The patch modified the default value of 1/4 mem_size to 1/8 mem_size which means if your HDD performs a 30MB/s in "hdparm -t" and your RAM is 512MB, you would have theoretically maximum 2 seconds waiting for atoms writing to disk(change the value as you wish).

At last, if you're paranoid enough for performance, use "formatting=extents" when mkfs.reiser4. Although tailing saves 5%-10% space, you gain more performance from do_sync_read().

Thanks!

2007/7/20, Adrian Glaubitz <[email protected]>:

Quoted 11 lines

Hello,

I found your posting on gmane about improvement for the reiser4-code to overcome some performance bottlenecks. I'm using reiser4 for my root-partiotion on my laptop and the disk is occasionally very busy with syncing for minutes. So, if possible, can you send me your patches to test them ?

Adrian

fs/reiser4/super_ops.c renamed from fs/reiser4/super_ops.c.orig +1 -0
@@ -449,6 +449,7 @@
 		   sbinfo->tmgr.atom_max_flushers);
 	seq_printf(m, ",cbk_cache_slots=0x%x",
 		   sbinfo->tree.cbk_cache.nr_slots);
+	seq_printf(m, ",fsync=%d", sbinfo->fsync);
 
 	return 0;
 }
fs/reiser4/super.h renamed from fs/reiser4/super.h.orig +2 -0
@@ -196,6 +196,8 @@
 	/* file-system wide flags. See reiser4_fs_flag enum */
 	unsigned long fs_flags;
 
+	int fsync;
+
 	/* transaction manager */
 	txn_mgr tmgr;
 
fs/reiser4/init_super.c renamed from fs/reiser4/init_super.c.orig +3 -1
@@ -305,6 +305,8 @@
 	opt_desc_t *opts, *p;
 	reiser4_super_info_data *sbinfo = get_super_private(super);
 
+	sbinfo->fsync = 100;
+
 	/* initialize super, export, dentry operations */
 	sbinfo->ops.super = reiser4_super_operations;
 	sbinfo->ops.export = reiser4_export_operations;
@@ -313,7 +315,7 @@
 	super->s_export_op = &sbinfo->ops.export;
 
 	/* initialize transaction manager parameters to default values */
-	sbinfo->tmgr.atom_max_size = totalram_pages / 4;
+	sbinfo->tmgr.atom_max_size = totalram_pages / 8;
 	sbinfo->tmgr.atom_max_age = REISER4_ATOM_MAX_AGE / HZ;
 	sbinfo->tmgr.atom_min_size = 256;
 	sbinfo->tmgr.atom_max_flushers = ATOM_MAX_FLUSHERS;
fs/reiser4/plugin/file/file.c renamed from fs/reiser4/plugin/file/file.c.orig +31 -9
@@ -22,6 +22,7 @@
 #include <linux/pagevec.h>
 #include <linux/syscalls.h>
 
+int fsync_num = 0;
 
 static int unpack(struct file *file, struct inode *inode, int forever);
 static void drop_access(unix_file_info_t *);
@@ -1403,22 +1404,43 @@
 	reiser4_context *ctx;
 	txn_atom *atom;
 	reiser4_block_nr reserve;
+	reiser4_super_info_data *sbinfo;
 
 	ctx = reiser4_init_context(dentry->d_inode->i_sb);
 	if (IS_ERR(ctx))
 		return PTR_ERR(ctx);
 
-	reserve = estimate_update_common(dentry->d_inode);
-	if (reiser4_grab_space(reserve, BA_CAN_COMMIT)) {
+	sbinfo = get_current_super_private();
+	if (sbinfo->fsync == 0)
+	{
 		reiser4_exit_context(ctx);
-		return RETERR(-ENOSPC);
+		return 0;
+	}
+	else if (sbinfo->fsync == 1)
+	{
+fsync_file:	reserve = estimate_update_common(dentry->d_inode);
+		if (reiser4_grab_space(reserve, BA_CAN_COMMIT)) {
+			reiser4_exit_context(ctx);
+			return RETERR(-ENOSPC);
+		}
+		write_sd_by_inode_common(dentry->d_inode);
+								
+		atom = get_current_atom_locked();
+		spin_lock_txnh(ctx->trans);
+		force_commit_atom(ctx->trans);
+		reiser4_exit_context(ctx);
+		return 0;
+	}
+	else if (sbinfo->fsync > 1)
+	{
+		fsync_num++;
+		if (fsync_num >= sbinfo->fsync) {
+			fsync_num = 0;
+			goto fsync_file;
+		}
+		reiser4_exit_context(ctx);
+		return 0;
 	}
-	write_sd_by_inode_common(dentry->d_inode);
-
-	atom = get_current_atom_locked();
-	spin_lock_txnh(ctx->trans);
-	force_commit_atom(ctx->trans);
-	reiser4_exit_context(ctx);
 	return 0;
 }