[DATA2EXT] [11/Dec] FULL BENCHMARK, V4, Improve the efficiency of IO

Search This thread

ownhere

Senior Member
Jun 17, 2010
213
286
Beijing
This script only for ROM Developers!

EDIT:2010/12/13 update explain:
1. Why three partition?
Answer:for get best balance of stabilty and performance.

2. Why don't use two partition and loopfile on 2nd partition(my script V1)?
Answer:Loopfile on 2nd partition need enable journaling on 2nd partittion file system to get stability after Unexpected loss of power or Unsafe reboot(without umount). And, enable journaling on a large partition is slower than small partition. In my phone, 1.3G /data/app don't need journal, only 300M /data/data need journal, so I use a small parition for safe and performance in V4.

3. Why not use ext4 directly at 3rd partition?
Answer:for speed up sqlite3, ext4 loopfile on ext4 device, make a huge improve for sqlite3 insert.

4.Why not NILFS2 or BRTFS?
Answer: I have already tried nilfs2 before I use ext4. nilfs2 crash my system. Brtfs marked 'EXPERIMENTAL' in kernel source(2.6.32.15), I like stability more than speed.


________________________________________________________________________________________
EDIT:2010/12/12 update V4 script:
/data/:ext4, disable journaling
/data/data:ext4 loopfile on ext4 device, enable journaling on ext4 device, disable journaling on ext4 loopfile, for fast and stable sqlite3 access.
really smooth this time. please trying...
________________________________________________________________________________________
EDIT:2010/12/11 FULL BENCHMARK: (all test use my sandisk C2 16G TF card, run in SuSE Linux 11.2 desktop)
I did a full benchmark for ext2/ext4, with loop or without loop, write, read, sqlite insert, this is result:

I do follow tests, umount after every test to prevent from kernel cache.
Sqlite3 db benchmark is insert 2000 records to db.

500 50k-2M files(random size) to 2G ext4 loopfile on ext4 device, enable journaling on ext4, sync after every file write.
write: 355 seconds
read: 52 seconds
db:76 seconds

500 50k-2M files(random size) to 2G ext4 loopfile on ext4 device, disable journaling on ext4, sync after every file write.
write: 212 seconds
read: 52 seconds
db:3 seconds

500 50k-2M files(random size) to 2G ext2 loopfile on ext4 device, with sync-in-mount-option, sync after every file write.
write: 380 seconds
read: 45 seconds
db: 3 seconds

500 50k-2M files(random size) to 2G ext2 loopfile on ext4 device, without sync-in-mount-option, sync after every file write.
write: 390 seconds
read: 45 seconds
db: 3 seconds

500 50k-2M files(random size) to ext4 device, enable journaling, sync after every file write.
write: 208 seconds
read: 47 seconds
db: 95 seconds

500 50k-2M files(random size) to ext4 device, disable journaling, sync after every file write.
write: 191 seconds
read: 48 seconds
db: 50 seconds

500 50k-2M files(random size) to ext4 device mount with loop option, enable journaling, sync after every file write.
write: 198 seconds
read: 51 seconds
db: 72 seconds


500 50k-2M files(random size) to ext4 device mount with loop option, disable journaling, sync after every file write.
write: 191 seconds
read: 50 seconds
db: 2 seconds


As you see, the best speed is: mount real ext4 device with loop option, disable journaling. The best balance of performance and safe is mount real ext4 device with loop option, enable journaling! We don't need a loopfile but just change mount option.:)
I attach my testsuit file below.
___________________________________________________________________
EDIT:2010/12/10 V3 changelog:
1.change loopback device to real partition for powersave and better write performance.
2.disable second partition's journaling.
3.You need 3rd partition for /data/data. But even without the third partition of this script can also work(not stable). My partition settings:second partition:1.5G, thrid partition:0.5G

Explain:
1.about NAND and SD: Desire have poor NAND memory for userdata, just 150M(this can be enlarged by MTD or HBOOT, but still small for me). This MTD partition need store app, dalvik-cache, app-data, it is too small to fill many apps.So someone think may be someting can be symbol link to SD, this is original Cyanogen A2SD, in this case , the /data/data directory is not moved to SD, because the battery reason and the speed need. This is what the HDROM 2NAND version do. So, the original A2SD is totally same as 2NAND. I don't known why the 2NAND be named. The NAND is not fast because it is yaffs2(journaling) filesystem, so if install many apps the phone will be slow(every app's sqlite have write demand)

2.about ext2/ext3/ext4: Ext2 have no journal feature, so lost power or just normal reboot will be crashed it, ext3 is journaling version of ext2. Ext4 is diffrent from ext2/ext3, it included Extends feautre, which provide better performance for large file(large than block size:4K). I analyze android system files, 4/5 is large than 4k, so the Extends feature is very useful. all EXTX system is base on Block, and the default block size is 1024 for small partition. Larger block size has better performance, so I force block size to 4096 when format.

3.about loopback device: The original Data2SD script make a huge loopback file for /data parition, then get better IO score. The reason is loopback device provide better Read performance. But the Write performance is wrose, so the phone got lag when install app or copy file.And the lag will occur suddenly. If system want to write data to loopback device, it is not real write, just write to kernel buffer/cache, the data will be flush to real disk when real filesystem(where loopback device stay on) got sync or commit command. So the real filesystem must enable journaling or do sync frequently。

4.about my old data2ext script: I try to splite directory to diffrent FS for the balance of performance and lag. Why I formated partition to EXT4? the reason can be found at item 2. Why create a small loopback device? the reason is item 3. But I found some bug with this case, any data write to loopback device need twice kernel IO command, one virtual one real, so the cpu usage will be high. Real EXT4 partition don't need journaling if no loopback device on it. For data integrity on virtual EXT4 loopback device, I had to enable journal on it.So I design new disk layout for better performance, it is DATA2EXT V3.
__________________________________________________________________
V2 change log:
1.change loopback device FS to EXT4 for journal, more stable
2.change mount option, add commit=large Prime number, reduce real IO, avoid concentration of commit. change journaling scheduler from Ordered to WriteBack to improve performance.


I would like to share my Data2EXT script, a collection of data2sd(Thanks to sibere) and the advantages of ext4, you can let the phone run at peak efficiency.

I use EXT4 for whole SD 2nd partition, and create a ext2 loopback device with 1/5 size of 2nd partition.

The files in /data/app,/data/.systemapp it not updated frequently. so store them in EXT4.

In /data/data and /data/app-private, a lot of small files and sqlite database, is updated frequently. so store thenm in EXT2 loopback device.

/data/dalvik-cache is stored in phone memory /mnt/asec/mtddata for distributed IO pressure.

/data/misc, /data/system, /data/property is stored in phone memory /mnt/asec/mtddata for system settings restore(or you will lost your timezone/language settings after reboot).

use this script, I can get quandrant score:2000+, IO:4000+, my phone is smooth and quickly.
 

Attachments

  • data2ext.zip
    2.1 MB · Views: 13,451
  • 01data2extV2.txt
    5.3 KB · Views: 2,983
  • 01data2extV3.rar
    1.3 KB · Views: 2,787
  • testsuite.zip
    241.3 KB · Views: 1,856
  • 01data2extV4.txt
    6.4 KB · Views: 5,122
Last edited:

Lo_RaT_PeNaT

Senior Member
Aug 5, 2008
1,258
218
Valencia
I do not understand that I do, only copy the script and reboot and automatically makes the whole process or do I have any other operation, thanks and apologies.

PD. I have read and believed the other post, which is to automatically process, the only problem was the FC, which was corrected by manager rom also lose the wifi, this script solves these problems?
 
Last edited:

Nitin985

Senior Member
Jun 30, 2010
1,538
121
Do you need to use any and on this and can u use an ext2 partition
Sent from my HTC Desire using XDA App
 

d3sm0nd

Senior Member
Dec 28, 2007
583
16
Sofia
Can someone explain how to apply the script? Do we have to create the partitions ourself or will the script create them?
Does it work on DHD Roms?
 

shawe_ewahs

Senior Member
Jun 20, 2009
324
15
Good job ownhere, I want to try your script on AuraxTSense, but this rom don't have mkfs.ext4 or mkfs.ext3, can you attached it to 1st post please?
 

jastonas

Senior Member
Jul 1, 2010
1,172
191
Patra
Redmi Note 10 Pro
+1 for a bit more detailed information.
I am not requesting, I am just politely asking with gratitude already since I guess this script will be implemented in future roms to come i guess..
 

ghmail2

Senior Member
Apr 30, 2010
501
48
busybox ---> /system/xbin
mkfs.ext4 ---> /system/xbin
01data2sd ---> init.d

yes i try again report back:)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 50
    This script only for ROM Developers!

    EDIT:2010/12/13 update explain:
    1. Why three partition?
    Answer:for get best balance of stabilty and performance.

    2. Why don't use two partition and loopfile on 2nd partition(my script V1)?
    Answer:Loopfile on 2nd partition need enable journaling on 2nd partittion file system to get stability after Unexpected loss of power or Unsafe reboot(without umount). And, enable journaling on a large partition is slower than small partition. In my phone, 1.3G /data/app don't need journal, only 300M /data/data need journal, so I use a small parition for safe and performance in V4.

    3. Why not use ext4 directly at 3rd partition?
    Answer:for speed up sqlite3, ext4 loopfile on ext4 device, make a huge improve for sqlite3 insert.

    4.Why not NILFS2 or BRTFS?
    Answer: I have already tried nilfs2 before I use ext4. nilfs2 crash my system. Brtfs marked 'EXPERIMENTAL' in kernel source(2.6.32.15), I like stability more than speed.


    ________________________________________________________________________________________
    EDIT:2010/12/12 update V4 script:
    /data/:ext4, disable journaling
    /data/data:ext4 loopfile on ext4 device, enable journaling on ext4 device, disable journaling on ext4 loopfile, for fast and stable sqlite3 access.
    really smooth this time. please trying...
    ________________________________________________________________________________________
    EDIT:2010/12/11 FULL BENCHMARK: (all test use my sandisk C2 16G TF card, run in SuSE Linux 11.2 desktop)
    I did a full benchmark for ext2/ext4, with loop or without loop, write, read, sqlite insert, this is result:

    I do follow tests, umount after every test to prevent from kernel cache.
    Sqlite3 db benchmark is insert 2000 records to db.

    500 50k-2M files(random size) to 2G ext4 loopfile on ext4 device, enable journaling on ext4, sync after every file write.
    write: 355 seconds
    read: 52 seconds
    db:76 seconds

    500 50k-2M files(random size) to 2G ext4 loopfile on ext4 device, disable journaling on ext4, sync after every file write.
    write: 212 seconds
    read: 52 seconds
    db:3 seconds

    500 50k-2M files(random size) to 2G ext2 loopfile on ext4 device, with sync-in-mount-option, sync after every file write.
    write: 380 seconds
    read: 45 seconds
    db: 3 seconds

    500 50k-2M files(random size) to 2G ext2 loopfile on ext4 device, without sync-in-mount-option, sync after every file write.
    write: 390 seconds
    read: 45 seconds
    db: 3 seconds

    500 50k-2M files(random size) to ext4 device, enable journaling, sync after every file write.
    write: 208 seconds
    read: 47 seconds
    db: 95 seconds

    500 50k-2M files(random size) to ext4 device, disable journaling, sync after every file write.
    write: 191 seconds
    read: 48 seconds
    db: 50 seconds

    500 50k-2M files(random size) to ext4 device mount with loop option, enable journaling, sync after every file write.
    write: 198 seconds
    read: 51 seconds
    db: 72 seconds


    500 50k-2M files(random size) to ext4 device mount with loop option, disable journaling, sync after every file write.
    write: 191 seconds
    read: 50 seconds
    db: 2 seconds


    As you see, the best speed is: mount real ext4 device with loop option, disable journaling. The best balance of performance and safe is mount real ext4 device with loop option, enable journaling! We don't need a loopfile but just change mount option.:)
    I attach my testsuit file below.
    ___________________________________________________________________
    EDIT:2010/12/10 V3 changelog:
    1.change loopback device to real partition for powersave and better write performance.
    2.disable second partition's journaling.
    3.You need 3rd partition for /data/data. But even without the third partition of this script can also work(not stable). My partition settings:second partition:1.5G, thrid partition:0.5G

    Explain:
    1.about NAND and SD: Desire have poor NAND memory for userdata, just 150M(this can be enlarged by MTD or HBOOT, but still small for me). This MTD partition need store app, dalvik-cache, app-data, it is too small to fill many apps.So someone think may be someting can be symbol link to SD, this is original Cyanogen A2SD, in this case , the /data/data directory is not moved to SD, because the battery reason and the speed need. This is what the HDROM 2NAND version do. So, the original A2SD is totally same as 2NAND. I don't known why the 2NAND be named. The NAND is not fast because it is yaffs2(journaling) filesystem, so if install many apps the phone will be slow(every app's sqlite have write demand)

    2.about ext2/ext3/ext4: Ext2 have no journal feature, so lost power or just normal reboot will be crashed it, ext3 is journaling version of ext2. Ext4 is diffrent from ext2/ext3, it included Extends feautre, which provide better performance for large file(large than block size:4K). I analyze android system files, 4/5 is large than 4k, so the Extends feature is very useful. all EXTX system is base on Block, and the default block size is 1024 for small partition. Larger block size has better performance, so I force block size to 4096 when format.

    3.about loopback device: The original Data2SD script make a huge loopback file for /data parition, then get better IO score. The reason is loopback device provide better Read performance. But the Write performance is wrose, so the phone got lag when install app or copy file.And the lag will occur suddenly. If system want to write data to loopback device, it is not real write, just write to kernel buffer/cache, the data will be flush to real disk when real filesystem(where loopback device stay on) got sync or commit command. So the real filesystem must enable journaling or do sync frequently。

    4.about my old data2ext script: I try to splite directory to diffrent FS for the balance of performance and lag. Why I formated partition to EXT4? the reason can be found at item 2. Why create a small loopback device? the reason is item 3. But I found some bug with this case, any data write to loopback device need twice kernel IO command, one virtual one real, so the cpu usage will be high. Real EXT4 partition don't need journaling if no loopback device on it. For data integrity on virtual EXT4 loopback device, I had to enable journal on it.So I design new disk layout for better performance, it is DATA2EXT V3.
    __________________________________________________________________
    V2 change log:
    1.change loopback device FS to EXT4 for journal, more stable
    2.change mount option, add commit=large Prime number, reduce real IO, avoid concentration of commit. change journaling scheduler from Ordered to WriteBack to improve performance.


    I would like to share my Data2EXT script, a collection of data2sd(Thanks to sibere) and the advantages of ext4, you can let the phone run at peak efficiency.

    I use EXT4 for whole SD 2nd partition, and create a ext2 loopback device with 1/5 size of 2nd partition.

    The files in /data/app,/data/.systemapp it not updated frequently. so store them in EXT4.

    In /data/data and /data/app-private, a lot of small files and sqlite database, is updated frequently. so store thenm in EXT2 loopback device.

    /data/dalvik-cache is stored in phone memory /mnt/asec/mtddata for distributed IO pressure.

    /data/misc, /data/system, /data/property is stored in phone memory /mnt/asec/mtddata for system settings restore(or you will lost your timezone/language settings after reboot).

    use this script, I can get quandrant score:2000+, IO:4000+, my phone is smooth and quickly.
    5
    As no one has done a tutorial for this, I will explain how I got it to work (I hope you work), the process is very simple:

    EDIT 12/12/2010

    If you go to use the ownhere's V4 script, now you need 3 primary partitions: Fat32+ext4+ext4, I recccomend GParted to do this (easy, free, compatible, small)

    Now attached a .bat to this post to do this procedure "automatically" (you need edit the .bat with your paths, with notepad++ for example).

    Summarizing:

    1- Install the rom (wiping...)
    2- BEFORE REBOOTING from recovery, delete te 40a2sd/10a2sd script from /system/etc/init.d through ADB (adb shell rm /system/etc/init.d/40a2sd)
    3- Reboot, and then customize your keyboard, fonts, themes, kernels...all the "flashables"
    4- When finished, reboot in recovery, mount /data and /system and execute the .bat (after modifying, of course)

    I recommend the use of V4 script (at least until V5 is released xD)

    PD: All thanks to Ownhere for his job ;)

    -----------------------------------------------------------------

    1- Make two primary partitions, one in FAT32 (for your data/photos/etc...) and another in ext4 (i do it from AmonRA's recovery: partition sdcard, swap=0,ext2=768mb,FAT32=Remain, when finished upgrade ext2 to ext3 and ext3 to ext4.

    2- Toggle USB (if needed for transfer the ROM .zip) and install the ROM as you normally would (do all wipes) , when ROM install finishes, connect via ADB shell and go to init.d & delete "apps2sd" script [i do it with Leedroid's ROM]
    (/system must be mounted, i reccomend mount all; sdcard, sd-ext, data and system)

    Code:
    adb shell rm /system/etc/init.d/40a2sd

    3- Do GANJDROID's instructions ;)
    Extract the zip into a folder, DO NOT FLASH IT!
    e2fsck - system/bin
    busybox - system/bin
    mkfs.ext4 - I didnt use becaise I dont have an ext4 partition, but if you do then put it in system/bin
    01data2sd - etc/init.d (something like that, search all system folders for the init.d folder and put it in there)

    For the system/bin files, I also pasted into system/xbin just to be sure
    Hope that helps some people out.

    I also pushed 3 files in /system/bin and /system/xbin

    Code:
    adb push "X:\Yourfolder\e2fsck" /system/bin/
    adb push "X:\Yourfolder\mkfs.ext4" /system/bin/
    adb push "X:\Yourfolder\busybox" /system/bin/
    adb push "X:\Yourfolder\e2fsck" /system/xbin/
    adb push "X:\Yourfolder\mkfs.ext4" /system/xbin/
    adb push "X:\Yourfolder\busybox" /system/xbin/

    and data2sd script to init.d

    Code:
    adb push "X:\Yourfolder\01data2sd" /system/etc/init.d/

    and give 777 permissions

    Code:
    adb shell
    chmod 777 /system/bin/e2fsck
    chmod 777 /system/bin/mkfs.ext4
    chmod 777 /system/bin/busybox
    chmod 777 /system/xbin/e2fsck
    chmod 777 /system/xbin/mkfs.ext4
    chmod 777 /system/xbin/busybox
    chmod 777 /system/etc/init.d/01data2ext

    Reboot and wait (~4 mins to boot...maybe more)
    1
    Guys there's a thread only god knows how many pages long that explains every possible variation on EXT* loopback devices..how about scrolling just a little next time?

    http://xdaforums.com/showthread.php?t=852219
    1
    The Rom is sure miui

    sent from the future