Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 Mar 2002 15:19:20 -0800
From:      Lars Eggert <larse@ISI.EDU>
To:        Zhihui Zhang <zzhang@cs.binghamton.edu>
Cc:        "Rogier R. Mulhuijzen" <drwilco@drwilco.net>, Julian Elischer <julian@elischer.org>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: A weird disk behaviour
Message-ID:  <3C855278.9040504@isi.edu>
References:  <Pine.SOL.4.21.0203051803150.13181-100000@onyx>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a cryptographically signed message in MIME format.

--------------ms040308070809020504010607
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Zhihui Zhang wrote:
> Well, the core of my program is as follows (RANDOM(x) return a value
> between 0 and x):
> 
>         blocksize = 8192;
>         write_size_low = 512;
> 
> 	time(&time1);
> 	for (i = 0; i < write_count; i++) {
> 		write_size = write_size_low +
>                          RANDOM(write_size_high-write_size_low);
> 		write_size = roundup(write_size, DEV_BSIZE);
> 		if (testcase == 1)
> 			write_size = blocksize;
> 		write_block(rawfd, sectorno, buf, write_size);
> 		sectorno += blocksize / DEV_BSIZE;
> 	}
>         time(&time2);
> 
> If testcase is one, then the time elapsed (time2 - time1) is much less.

How "much less" in milliseconds?

Also, in your original mail, you said you had 15,000 of these 8K blocks, 
which is only 120MB or so. Use 150,000 or 1,500,000 and check your 
results then.

Lars



> -Zhihui
> 
> On Tue, 5 Mar 2002, Lars Eggert wrote:
> 
> 
>>I agree that it's probably caching at some level. You're only writing 
>>about 120MB of data (and half that in your second case). Bump these to a 
>>couple of GB and see what happens.
>>
>>Also, could you post your actual measurements?
>>
>>Lars
>>
>>
>>Zhihui Zhang wrote:
>>
>>>The machine has 128M memory. I am doing physical I/O one block at a time,
>>>so there should be no memory copy.
>>>
>>>-Zhihui
>>>
>>>On Tue, 5 Mar 2002, Rogier R. Mulhuijzen wrote:
>>>
>>>
>>>
>>>>At 16:03 5-3-2002 -0500, Zhihui Zhang wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>On Tue, 5 Mar 2002, Julian Elischer wrote:
>>>>>
>>>>>
>>>>>
>>>>>>more writes fit in the disk's write cache?
>>>>>>
>>>>>>
>>>>>For (1), it writes 15000 * 8192 bytes in all.  For (2), it writes 15000 *
>>>>>4096 bytes in all (assuming the random number distributes evenly between 0
>>>>>and 8192).  So your suggestion does not make sense to me.
>>>>>
>>>>>
>>>>How large is your buffercache?  it might be that the 15000 * ~4096 roughly 
>>>>matches with your cache, and 15000 * 8912 doesn't.
>>>>
>>>>Case (1) would require a lot more physical IO in that case than case (2) 
>>>>would require.
>>>>
>>>>        Doc
>>>>
>>>>
>>>>
>>>>
>>>>>-Zhihui
>>>>>
>>>>>
>>>>>
>>>>>>On Tue, 5 Mar 2002, Zhihui Zhang wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>I am doing some raw I/O test on a seagate SCSI disk running FreeBSD 4.5.
>>>>>>>This situation is like this:
>>>>>>>
>>>>>>>+-----+----+----+----+----+----+----+----+----+----+---+------
>>>>>>>|     |    |    |    |    |    |    |    |    |    |   | ....
>>>>>>>+-----+----+----+----+----+----+----+----+----+----+---+------
>>>>>>>
>>>>>>>Each block is of fixed size, say 8192 bytes. Now I have a user program
>>>>>>>writing each contiguously laid out block sequentially using /dev/daxxx
>>>>>>>interface. There are a lot of them, say 15000.  I write the blocks in two
>>>>>>>ways (the data used in writing are garbage):
>>>>>>>
>>>>>>>(1) Write each block fully and sequentially, ie. 8192 bytes.
>>>>>>>
>>>>>>>(2) I still write these blocks sequentially, but for each block I only
>>>>>>>write part of it.  Exactly how many bytes are written inside each 
>>>>>>>
>>>>>>>
>>>>>block is
>>>>>
>>>>>
>>>>>>>determinted by a random number between 512 .. 8192 bytes (rounded up a
>>>>>>>to multiple of 512 bytes).
>>>>>>>
>>>>>>>I find out the the performance of (2) is several times better than the
>>>>>>>performance of (1). Can anyone explain to me why this is the case?
>>>>>>>
>>>>>>>Thanks for any suggestions or hints.
>>>>>>>
>>>>>>>-Zhihui
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>To Unsubscribe: send mail to majordomo@FreeBSD.org
>>>>>>>with "unsubscribe freebsd-hackers" in the body of the message
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>To Unsubscribe: send mail to majordomo@FreeBSD.org
>>>>>with "unsubscribe freebsd-hackers" in the body of the message
>>>>>
>>>>>
>>>
>>>To Unsubscribe: send mail to majordomo@FreeBSD.org
>>>with "unsubscribe freebsd-hackers" in the body of the message
>>>
>>>
>>
>>
>>-- 
>>Lars Eggert <larse@isi.edu>               Information Sciences Institute
>>http://www.isi.edu/larse/              University of Southern California
>>
>>
> 



-- 
Lars Eggert <larse@isi.edu>               Information Sciences Institute
http://www.isi.edu/larse/              University of Southern California

--------------ms040308070809020504010607
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIInzCC
ArUwggIeoAMCAQICAwWBRzANBgkqhkiG9w0BAQIFADCBkjELMAkGA1UEBhMCWkExFTATBgNV
BAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMQ8wDQYDVQQKEwZUaGF3dGUx
HTAbBgNVBAsTFENlcnRpZmljYXRlIFNlcnZpY2VzMSgwJgYDVQQDEx9QZXJzb25hbCBGcmVl
bWFpbCBSU0EgMjAwMC44LjMwMB4XDTAxMDgyNDE2NDAwMFoXDTAyMDgyNDE2NDAwMFowVDEP
MA0GA1UEBBMGRWdnZXJ0MQ0wCwYDVQQqEwRMYXJzMRQwEgYDVQQDEwtMYXJzIEVnZ2VydDEc
MBoGCSqGSIb3DQEJARYNbGFyc2VAaXNpLmVkdTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
gYEA0AvLBsD78nxcUHe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ENlcnRpZmljYXRlIFNlcnZpY2VzMSgwJgYD
VQQDEx9QZXJzb25hbCBGcmVlbWFpbCBSU0EgMjAwMC44LjMwAgMFgUcwDQYJKoZIhvcNAQEB
BQAEgYCNmzwowVRhj8pRFsmXXLMm12hUcRvfVccoHzszwtX/ZRbKteXOUbalcAgLQVn+Ovxv
2o7gY4H4RlNFLIGR1wmhPgjosGd+t1BIcoVxl2n8nfxJpRGNTZSQt4eM0mfDPBYtIXhrHcos
3XQI+uU2Kn073UKzyHCYjA2zqim+tIjhLQAAAAAAAA==
--------------ms040308070809020504010607--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C855278.9040504>