Apache Serves Images Slowly

Today I had a really interesting and strange problem with the Apache WWW server. It served images very slowly under even light loads and there was really no explanation for this. The CPU on the host machine almost idle and network throughput was nominal too.

After some digging on the internet I found other people also had had this problem, and had suggested various methods to remedy this, like enabling caching and putting images on a separate machine and disabling the KeepAlive feature.

After reading about the KeepAlive, I tried disabling it and suddenly got 10x more load through! Apache’s HTTP KEEPALIVE had been active (“On” by default). Turning this off with “KEEPLIVE OFF”  in httpd.conf solved the problem.

Previously I had around 4 pages/sec (10 hits/sec) as the maximum speed, but after the change I’m seeing more than 40 pages/sec and the host machine CPU is around 35%. This leads me to beliwve that I can get as much as 100 pages/sec from the current hardware configuration without problems.

The application was a test-bed app that uses the FireBird SQL database to handle sessions and dynamic data, all on the same machine.

Machine specifications are:

  • ThinkPad T61p (Laptop)
  • Intel 2.2 GHz DualCore (T7500)
  • Windows XP SP2, 4 Gig’s RAM
  • Apache v2.2.9 (Win32) / PHP v5.2.6

The configurations are “out of the box” and the only changes made to the configurations are enabling PHP support in Apache.

This leads me to conclude that there is something wrong with the “KeepAlive” in Apache, but I do not have time to look into this any further now, maybe later..

EDIT: I was in error to assume there was somehting amiss with the KeepAlive feature, there is nothing wrong with it. The test-bed app only has a one or two images/page but thousands of users accessing it so the KeepAlive feature slows down more than it helps. It’s just the nature of the Keepalive feature to do what it did!

Advertisements

4 thoughts on “Apache Serves Images Slowly

  1. […] The application was a test-bed app that uses the FireBird SQL database to handle sessions and dynamic data, all on the same machine. [Performance Tip :Seems that you need to put KeepAlive Off on apache to server many images and too many clients :If you have more clients than available apache children, KeepAlive settings will hurt overall performance and should be turned off.] Permalink | Share:                       […]

  2. for images try to use an better server that can handle images better and faster

    You can try ngnix for windows
    http://www.kevinworthington.com/2008/08/14/announcing-nginx-for-windows-0710-win32/

    this is some configuration i have proposed to an existing php application that had issues with
    apache and image loading
    http://mapopa.blogspot.com/2008/07/moving-hosts-to-nginx-scaling-plan-in.html
    this is why nginx is better than apache at serving content
    http://drupal.org/node/110224

  3. bạn muốn kinh doanh nhà trọ Việc tiếp theo chính là lập dự toán chi phí xây dựng nhà ở để xác định nguồn vốn tài chính mà gia
    chủ mang đi đầu tư..… Hãy gọi cho chúng tôi để được hổ trợ
    tư vấn giá cả họp lý theo tiêu chuẩn xây dựng nhà ở của bộ xây
    dựng Công ty xây dựng nhà trọn gói Hữu Thắng Bước thứ 3
    cũng là bước cuối cùng trong trình tự xây nhà là thi công và hoàn công.
    Hầu hết việc này được giao cho đơn vị
    nhà thầu hoàn tất…… Hóc Môn những lời nói xuôi tai và chắc như
    đinh đóng cột nhưng sau đó là khiến bạn mất thời gian và
    tiền bạc do thiếu tính minh bạch và rõ ràng ngay từ lúc ký kết.,.…
    Hãy liên hệ với chúng tôi để được tư vấn và báo giá tốt
    nhất.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s