You are not logged in.

#1 2012-02-04 15:59:16

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

tmpfs useful for a webserver hosting static files?

When hosting a webserver like Apache, serving mainly static files, is it useful to place those files on tmpfs instead of the harddisk? Under normal circumstances, say if a small file (~10k) is requested 100 times, does the kernel already cache the file in ram on the first read and continues to serve that? If so, is there any indication how large the kernel's buffer is for this, and how long the file is actually cached?

Last edited by litemotiv (2012-02-04 16:08:15)


ᶘ ᵒᴥᵒᶅ

Offline

#2 2012-02-12 14:16:07

revellion
Member
From: Sweden
Registered: 2007-04-10
Posts: 54

Re: tmpfs useful for a webserver hosting static files?

Linux optimistically caches almost every file access in RAM unless an application explicitly allocates memory so it has to be free'd.

In a 10k file it's very likely to be in RAM cache unless you are very memory pressured.

So tmpfs wouldn't do you that much good in most of the cases, you could see more performance boosts from example moving to lighttpd as a web-server or similar high-performance/low-overhead HTTP Server.


Hurricane Electric Certified IPv6 Sage

CPU: Core i7-2600 @ 4.0Ghz | RAM: 16GB (4x4GB) | GFX: AMD Radeon R9 290 4096MB VRAM | HDD: 1x 120GB SATA3 Corsair SSD (~500MB/s RW), 1x SATA2 250GB, 1x SATA2 320GB, 1x 180GB SATA3 Intel SSD
*EDIT* Replaced Nvidia GTX 570 for a AMD Radeon R9 290, and added an extra SSD 180GB

Offline

Board footer

Powered by FluxBB