简体   繁体   中英

apache/php : possible to throttle uploads?

My website allows users to upload their photos

Can I put kb/sec (or similar) limit on uploads to prevent them impacting performance of the frontend of my site?

如果您受到如此强烈的性能影响,则应将网站拆分为多台服务器,一台提供只读内容,另一台在用户通过上传文件或进行数据库更新进行交互时使用。

Slowing down the upload (or download) bandwidth will actually make the impact elsewhere worse - not better until you actually get to the point where all your incoming bandwidth is used up.

Before you seize on the caveat I've just given - this is a very unusual scenario for a webserver. Go measure your bandwidth usage in and out first.

If the very remote possibility that your incoming bandwidth is completely hogged by uploading then you really need to stop people from uploading som much - not slow them down so that the process hogs memory, CPU and processes for longer.

It is usually a good idea to limit the connection rate (not bandwidth) per client address to protect against DOS attacks - but this is better done at the perimeter of your network rather than on the server itself.

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