Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
680 views
in Technique[技术] by (71.8m points)

linux - How much does using htaccess files slow down website performance (especially with solid state disks)?

The Apache docs say (http://httpd.apache.org/docs/2.4/howto/htaccess.html),

"You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance."

But that gives me no idea of the scale of the impact.

I have an architecture designed for shared hosting where the only choice was to use htaccess files.

I'm moving over to Digital Ocean where I can do what I like.

I need to make a judgement on whether to stick with htaccess files or move stuff from there into the centralized config files and switch them off.

There could be 100s of small low-use sites (local businesses).

If the performance hit amounts to under about 50ms in serving a page or has some other minor hit like reducing the number of concurrent accesses that can be supported by under about 5%, then I don't care.

If the effect is big enough that people might feel the difference, then I care enough to spend time changing things.

But I've found nothing that gives me an indication of what order of magnitude of the hit I can expect.

Can anyone enlighten me?

Edit: I'm not looking for anything like exact numbers. But surely someone somewhere who is more able than me has done some benchmarking, or knows from experience the type of difference there can be under particular circumstances.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

From an answer on Quora by Jonathan Klein, 12ms for a 1500 line .htaccess file:

Having a large .htaccess does have a cost. Ours is currently ~1500 lines and we benchmarked the time spent parsing it at around 10-12ms on a production webserver. Hardware makes a difference obviously, but you can fairly safely assume that the cost of that 3000 line .htaccess is around 25-35ms per request.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...