From owner-freebsd-questions@FreeBSD.ORG Tue Nov 21 23:06:29 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B897D16A403 for ; Tue, 21 Nov 2006 23:06:29 +0000 (UTC) (envelope-from freebsd@sopwith.solgatos.com) Received: from schitzo.solgatos.com (pool-71-117-237-189.ptldor.fios.verizon.net [71.117.237.189]) by mx1.FreeBSD.org (Postfix) with ESMTP id 71EDD43D53 for ; Tue, 21 Nov 2006 23:06:02 +0000 (GMT) (envelope-from freebsd@sopwith.solgatos.com) Received: from schitzo.solgatos.com (localhost.home.localnet [127.0.0.1]) by schitzo.solgatos.com (8.13.7/8.13.6) with ESMTP id kALN6QdO021168 for ; Tue, 21 Nov 2006 15:06:26 -0800 Received: from sopwith.solgatos.com (uucp@localhost) by schitzo.solgatos.com (8.13.7/8.13.4/Submit) with UUCP id kALN6QxQ021165 for freebsd-questions@freebsd.org; Tue, 21 Nov 2006 15:06:26 -0800 Received: from localhost by sopwith.solgatos.com (8.8.8/6.24) id WAA29357; Tue, 21 Nov 2006 22:47:23 GMT Message-Id: <200611212247.WAA29357@sopwith.solgatos.com> To: freebsd-questions@freebsd.org In-reply-to: Your message of "Mon, 20 Nov 2006 11:19:52 EST." <20061120111952.4213dacb.wmoran@collaborativefusion.com> Date: Tue, 21 Nov 2006 14:47:23 +0000 From: Dieter Subject: Re: TCP parameters and interpreting tcpdump output X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Nov 2006 23:06:29 -0000 In message <20061120111952.4213dacb.wmoran@collaborativefusion.com>, Bill Moran writes: > > But... if I do something like copy a large file from one disk to another, > > and then do something that needs to read from a third disk, the new process > > may hang for a very very long time. If I suspend (^Z) the copy process for > > a moment, the new process gets its data. I suspect that the kernel is > > letting the copy process kick everything else out of memory. To some extent > > that makes sense. It is caching the most recently accessed data. What I > > haven't figured out is why the new process is allowed to hang for so long. > > I'm surprised that you're seeing that much of a "hang". Even if the disks > are busy, the system should slow down all disk processes equally, so no > one process "blocks", but they're all a little slower. That is what I would expect, but that is not what I get. > > I had thought of putting in a circular buffer, but figured that it should > > be unnecessary since the normal Unix write-behind should buffer the > > writes from the disk I/O for me. I'll give it a try, maybe it will help. > > First, use the /dev/null test to verify whether or not the disks really > are the problem. You don't want to waste a lot of time on something > that may be unrelated. It works much better with /dev/null. With a circular buffer, it seems to work unless I generate a lot of disk I/O to the same disk it is writing to. I can do a "cat big_file > /dev/null" and it works if big_file is on a different disk. But with I/O to the same disk it fails. Seeks are slow so this isn't surprising. Despite the seeking, if I do a "cat big_file > /dev/null" (with big_file on the same drive) I still get about 45-50 MiB/s according to systat -vmstat. The weird thing is *how* it fails. The write doesn't fail or return a short count. The buffer never fills up. It is the read from the socket that fails: reading 1316 bytes from port read() from socket failed: Connection reset by peer SWAG: I wonder if having stdout be non-blocking means that the kernel is doing some sort of behind-the-scenes locking of the memory specified in the write call? So the buffer is really filling up, it just isn't visible to me? Then when the read pointer catches up to the locked memory the kernel blocks the read call, and the src machine eventually gets tired of waiting and drops the connection?