# Serving big files at constant rates

**URL:** <https://www.ruby-forum.com/t/serving-big-files-at-constant-rates/219725>\
**Category:** NGINX\
**Created:** [May 14, 2012, 2:00am UTC](https://www.ruby-forum.com/t/serving-big-files-at-constant-rates/219725 "2012-05-14T02:00:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurdipe\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b77776/32.png) [@Gurdipe\_D](https://www.ruby-forum.com/u/Gurdipe_D)\
**Post date:** [May 14, 2012, 2:00am UTC](https://www.ruby-forum.com/t/serving-big-files-at-constant-rates/219725/1 "2012-05-14T02:00:10Z")

</div>

Hi,

A recent thread kept my attention recently:

> **[All workers in 'D' state using sendfile](https://forum.nginx.org/read.php?2,226327)**
>
> Hello, I have tried to summarize this as much as possible but it's still a lot of text. I apologize but wanted to make sure that I provide enough information to explain the issue properly. I'm hoping that somebody that uses nginx as a high...

I don’t have such a big trouble, but I don’t see how to solve it.

My server usually serves small files suchas classical web pages.  
On a particular location, though, I serve big files (around 100MB+).

I noticed that when those files were served, there was ‘bumps’ in the  
transfer rate, whether the trasnfer stalled for 1s or the transfer rate  
downgraded to 500Kb/s during the same period.  
Those bumps were monitored server-side, so it is not some trouble in any  
network in the middle.  
I ensured that the only service using significant bandwith would be  
Nginx.

I guess I am experiencing some disk I/O speed limitations.  
Thus, I tried to use aio on that location:  
aio on;  
directio 4m;  
output\_buffers 1m; (I tried 512k first hand)

The bumps are still there, appearing randomly but quite often and  
regularly  
on the long shot.

What kind of I/O trouble is that?

## Thanks,

_B. R._

---

<div class="post-metadata">

**Author:** ![B.R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3be4f8/32.png) [@B.R](https://www.ruby-forum.com/u/B.R)\
**Post date:** [May 15, 2012, 5:09am UTC](https://www.ruby-forum.com/t/serving-big-files-at-constant-rates/219725/2 "2012-05-15T05:09:10Z")

</div>

Hi,

I tried that, but I only see these consequences:

- Higher peek transfer speed (up to 1.1/1.2 MiB/s)
- Higher instability (bumps down to 300/400 KiB/s and with longer  
duration)
- Lower average transfer rate overall

## Well, does that mean I have some network interfaces trouble?

_B. R._

---

<div class="post-metadata">

**Author:** ![B.R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3be4f8/32.png) [@B.R](https://www.ruby-forum.com/u/B.R)\
**Post date:** [May 14, 2012, 6:29pm UTC](https://www.ruby-forum.com/t/serving-big-files-at-constant-rates/219725/3 "2012-05-14T18:29:56Z")

</div>

Why not create a 1gb ramdrive to make sure it is a disk IO issue. It  
might be a lan driver buffer issue.

Posted at Nginx Forum:

> **[Re: Serving big files at constant rates](https://forum.nginx.org/read.php?2,226392,226422#msg-226422)**
>
> Hi, A recent thread kept my attention recently: http://forum.nginx.org/read.php?2,226327 I don't have such a big trouble, but I don't see how to solve it. My server usually serves small files suchas classical web pages. On a particular location, tho

---

<div class="post-metadata">

**Author:** ![B.R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3be4f8/32.png) [@B.R](https://www.ruby-forum.com/u/B.R)\
**Post date:** [May 15, 2012, 12:37pm UTC](https://www.ruby-forum.com/t/serving-big-files-at-constant-rates/219725/4 "2012-05-15T12:37:38Z")

</div>

Could very well be a lan driver issue, rx/tx values too high or rx value  
higher then tx, flow control not used or used but not supported,  
etc… try an older driver or if its really old a newer one. Also see  
if you can get a driver with debugging compiled in or support for raw  
mode and run something like wireshark to see whats going on.

Posted at Nginx Forum:

> **[Re: Serving big files at constant rates](https://forum.nginx.org/read.php?2,226392,226444)**
>
> Hi, A recent thread kept my attention recently: http://forum.nginx.org/read.php?2,226327 I don't have such a big trouble, but I don't see how to solve it. My server usually serves small files suchas classical web pages. On a particular location, tho
