performance - HTTP Basic Auth、读取密码文件和性能

标签 performance apache2 nginx lighttpd http-authentication

我很想知道在 Apache、lighttpd 或 nginx 等网络服务器上使用 HTTP 基本身份验证对性能有何影响。我想瓶颈是服务器实际读取文件以验证用户身份。在我看来,读取文件以验证用户身份的成本与该文件中的用户数量成正比。

我的问题是:
1. 是否存在特定数量的用户,通过文件进行的基本身份验证开始急剧下降,或者与文件中的用户数量成线性关系?
2. 鉴于 http 的无状态特性,如果 Web 服务器已针对一个请求使用 HTTP Basic Auth 对用户进行了身份验证:
- 它是否只是转发每个请求的凭据,并且网络服务器每次都必须解析密码文件以确定这是否是来自有效用户的请求?

- 获取类似 token 之类的东西,在后续请求的 http header 中使用,从而允许服务器避免再次解析密码文件?

提前致谢

最佳答案

  1. 线性相关。我不会担心。 HTTP Basic Auth 被证明是可扩展的。仅以 Twitter API 为例。它使用基本身份验证。

  2. "Because the HTTP protocol is stateless, each request will be treated in the same way, even though they are from the same client. That is, every resource which is requested from the server will have to supply authentication credentials over again in order to receive the resource. Fortunately, the browser takes care of the details here, so that you only have to type in your username and password one time per browser session - that is, you might have to type it in again the next time you open up your browser and visit the same web site."

详细信息在 Apache Auth documentation .

关于performance - HTTP Basic Auth、读取密码文件和性能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1463293/

相关文章:

c# - 什么时候分配一个新线程?

java - 使用 Maven 进行自动化负载测试的经过尝试和测试的方法

Ruby 应用仅在 Passenger 为 "disabled"时有效

有很多模型的 wpf 3d

c++ - 类型转换是否会消耗额外的 CPU 周期

Laravel 5.4 Backpack 无法删除项目,返回 "403 Forbidden"错误

php - Apache 被本地主机 (127.0.0.1) 击中

docker - Google Cloud ESP 向 gRPC 服务器通告无效的压缩格式

docker - 无法使用 docker-compose 挂载文件

PHP-FPM 监听队列已满,我的配置有什么问题?