简体   繁体   中英

Any performance difference between http 304 and 404?

We have a web site that does not have a favourite icon favicon.

Therefore, we get a lot of http 404 errors for the file favicon.ico.

For the functionality of the web site it does not make a difference.

But I was wondering if the system uses more time looking for a file that is not there, rather than returning a 304 not modified?

At max load we have ca. 15,000 concurrent connections across all frontend servers.

No, the performance difference is insignificant - if you don't want to have a favicon, I'd suggest creating a 0-byte /favicon.ico: the logs will stop complaining, and the browsers will behave as if there's no favicon.

Also, you could set a far future Expires header for your favicon - that way, the clients will only request it once, further reducing the load.

In terms of the load the request causes on the server, there is no difference. In terms of network bandwidth, a valid 304 response will be a bit bigger, since you also have to include at least a Date and an Expires or ETag headers in the response.

If the idea is to send a response without content, then I think 204 No Content is more appropriate.

If you are absolutely sure that the web site will never ever have a favicon, you could use a 410 Gone response. That tells the client/browser to don't come back and ask again. It is also more likely to be cached by a proxy server than a 404.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM