gpt4 book ai didi

php - 增加php websocket最大连接数

转载 作者:行者123 更新时间:2023-12-04 16:13:04 30 4
gpt4 key购买 nike

我目前正在运行带有 PHP 和 Apache 的 Debian 8 机器。

在这台机器上,我安装了一个 Ratchet websocket 服务器,尽管我最近在我运行的网站上访问了超过 1000 个并发用户。
这导致 Ratchet 套接字出现问题,因为在 1020 个连接时,它似乎会自动拒绝所有新连接。

我已经增加了ulimit -n和 debian 本身类似,但我开始怀疑问题是否出在我的 php 默认配置或我正在使用的 Ratchet websocket 中。

关于我应该更改什么配置的任何想法都非常感谢。

最佳答案

你只需要阅读部署中的官方文档
部分:它说:

The libev and libevent projects implement high-performance asynchronous event driven C libraries. The PHP extensions ev and event are available to interface with these libraries. They allow an application to transparently use the best kernel level evented I/O method (select, poll, epoll, kqueue, or event ports) available for the operating system it is running on.

The ev PHP extension bundles the libev C library in its source and requires no prior setup. If you want to use the event PHP extension, you need to first install the libevent library along with its headers for your operating system. For example on Debian/Ubuntu:



- $ sudo apt-get install libevent libevent-dev

You may then install the ev or the event extension, either through your preferred package manager, or directly using pecl:



- $ sudo pecl 安装 ev

- $ sudo pecl 安装事件

No further setup is necessary; if either of these extensions is present, the evented I/O loop toolkit used by Ratchet will automatically utilize them, which will drastically improve concurrency. here is the link: http://socketo.me/docs/deploy

关于php - 增加php websocket最大连接数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37093457/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com