swoole | FastD Swoole 基础组件 - 高性能网络服务组件 | Application Framework library
kandi X-RAY | swoole Summary
kandi X-RAY | swoole Summary
高性能网络服务组件. 提供底层服务封装, 基础管理及客户端调用功能. 使用 composer 进行管理, 可在此基础上进行封装整合.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Get server status
- Watch directories .
- Wrap the body .
- Start the child process .
- Set an event .
- On request
- onReceive
- Handles a packet
- Handle swoole process
- Forward request to specified URL .
swoole Key Features
swoole Examples and Code Snippets
Community Discussions
Trending Discussions on swoole
QUESTION
I installed docker and downloaded an ubuntu distro to run with laravel sail,planing to use swoole php,and made it default,also made wsl version to 2
with docker-compose.yml ready from laravel sail docker-compose.yml:
but every time I try to run the sail up cmd,it gives me this error " Unsupported operating system [MINGW64_NT-10.0]. Laravel Sail supports macOS, Linux, and Windows (WSL2)."
any ideas how to fix this ?
...ANSWER
Answered 2021-Feb-28 at 23:53You need to run the sail up command from inside your WSL2 Ubuntu Image not directly from your terminal. Once you do that it should work ok
QUESTION
When Swoole is on heavy load and heavy requests I kept getting this Log:
[2021-01-24 16:07:22 *33833.2] NOTICE finish (ERRNO 1005): session#21022 does not exists
[2021-01-24 16:07:22 *33833.2] NOTICE finish (ERRNO 1005): session#21022 does not exists
[2021-01-24 16:07:22 *33833.2] NOTICE finish (ERRNO 1005): session#21022 does not exists
[2021-01-24 16:07:22 *33833.2] NOTICE finish (ERRNO 1005): session#21022 does not exists
[2021-01-24 16:07:39 *33835.4] NOTICE finish (ERRNO 1005): session#21025 does not exists
[2021-01-24 16:07:39 *33835.4] NOTICE finish (ERRNO 1005): session#21025 does not exists
[2021-01-24 16:07:39 *33835.4] NOTICE end (ERRNO 1005): session[21025] is closed
Or
[2021-01-23 14:07:22 *5300.3] NOTICE php_swoole_http_onReceive (ERRNO 1005): session[10002] is closed
[2021-01-23 14:07:22 *5300.3] NOTICE php_swoole_http_onReceive (ERRNO 1005): session[10042] is closed
[2021-01-23 14:08:21 *5326.29] NOTICE php_swoole_http_onReceive (ERRNO 1005): session[10508] is closed
[2021-01-23 14:18:15 *5333.36] NOTICE finish (ERRNO 1005): session#12755 does not exists
[2021-01-23 14:18:15 *5333.36] NOTICE end (ERRNO 1005): session[12755] is closed
In example I send total 500k requests with 1k concurrent requests, it logs this errors and hangs !
And suddenly it hangs !
My server is Centos 7, 8 gigabytes of RAM and 4 cores of CPU.
Swoole is running with 40 workers, + 30 Master-Worker and 8 Reactor.
Even in production this happens too.
Can some one help me or explain me why this happens and maybe how can I solve it?
Thanks.
ANSWER
Answered 2021-Jan-24 at 19:12Ok I have found where is the problem. Actually it's not a bug in Swoole or my application. It's a notice log that can get disabled with log_level property of Swoole server configuration. This happens when a Client closes swoole tab or browser (Closes client connection), so it gets disconnected so Swoole cannot retrieve users session and logs this notice. Also if you are using bench marking tools like Apache ab or WRK, If a problem occurs, These testers will terminate all other requests and stop whole testing. So sessions get closed and logs written again.
QUESTION
I have installed php/swoole on my server and configured it using Laravel swoole
Now The problem is everything works fine until total requests per second number increase more than 1000 requests.
Swoole will log an error and not responding to user !
I have set Operating system ulimit number to 50000
But still get same error ! Searching all over internet and find nothing !
Os Centos 7
Server is good enough to handle more than 1k requests per second
If you have any experience about this please share it with me
Note:
When swoole starts, it logs this error too:
set_max_connection: max_connection is exceed the maximum value, it's reset to 1024
ANSWER
Answered 2021-Jan-19 at 14:48Ok I have figured it out.
lets first say that how I ran PHP-Swoole process: .
I have made a systemd service in centos in order to launch swoole process all the time in any situation..
So the ULimit command sets ulimit for current shell that you are in it. Not the systemd shell that is running swoole starter process..
For that you need to add LimitNOFILE=100000
option under systemd [Service]
section block.
And with a restart everything works fine.
QUESTION
I'm trying to understand how are we supposed to manage client in Swoole Websocket Server.
I've MyServer who extends from Swoole\WebSocket\Server, I store in a property the client list, but it seems every single client can only see his own list (with only him in it). So if the client 1 send a message who have to be resent to the client 2, the only I've found is to use the getClientList method and send the message to all clients.
But I want also to "bind" clients between themselves ... Like 1 with 2 only, 3 with 4 a,nd 5 etc.
I use APCu (forced to CLI mode) to communicate client list to all my client, but it seems I've some multi acces problems now.
Isnt a "native" way in Swoole Websocket Server to store information on my client, information who could by read from any client?
...ANSWER
Answered 2020-Jul-12 at 07:51After some more research, I found that Swoole provide a nice build-in class to manage session interaction : Swoole/Table
It's a fast "SQL like" memory management system that allow you to easily communicate between sessions, specifically usefull for websockets session!
QUESTION
I have installed Laravel 5 with php7 and which is working perfectly on my Windows machine. Recently I came to know that SWOOLE is a promising tool for PHP developers!
Unfortunately, I couldn't find any SWOOLE installers for windows.
Isn't it possible to install SWOOLE on a Windows machine, if so how?
Thanks in advance.
...ANSWER
Answered 2018-Jul-01 at 20:43No.For now swoole is only supported for linux and Mac.
QUESTION
Am trying to install swoole using PHP 7.0.2 in MAMP
...ANSWER
Answered 2018-Jul-30 at 03:20I have no luck installing Swoole via home brew or pecl. So I installed it manually and works. So here my step:
Make sure you php installed on your osx
QUESTION
I'm playing around learning Docker and Swoole. Running a Docker container that contains 2 files and an empty directory. Upon accessing the HTTP server in browser, the image is not displayed (getting the broken image icon).
I've already tried a PNG from an external webpage, that image was displayed properly. I've also tried "docker run -it hello-swoole sh" and confirmed the container displays
...ANSWER
Answered 2019-Aug-23 at 04:05I would assume you have to also program the server to serve the static files.
QUESTION
I am trying to build a Symfony 4.3.3 command where I want to add the ability for callback functions to be overwritten at any time. Look at the following code snippet:
...ANSWER
Answered 2019-Aug-14 at 19:43You still want to create a closure to pass to $server->on
. You can do as such with:
QUESTION
So I tried to test php framework on my localhost (6 year old i7 pc) using:
...ANSWER
Answered 2019-Aug-10 at 10:53Yes, Wrk is one of the most respected benchmarking tool but you can not tell you boss that your application will handle 176,000 requests/second
because there will be some added conditions which will reduce the application performance. To get the correct benchmark score you can test by replicating all those conditions on your development environment and try benchmarking.
Conditions like
- Database Connection (if Application is using Database)
- Server Configuration
- Reverse Proxy from your HTTP Server (i.e. Nginx or Apache) Very important
- And other application-specific conditions
QUESTION
Async Mysql Client of Swoole in my PHP Project for which I am trying to use Swoole MySQL Class of PHP but I am getting
class not found
error while executing the code.
Below is the code snippet I was trying to execute:
...ANSWER
Answered 2019-Aug-07 at 07:41It seems that the official documentation is either a bit off, or mentions a previous version of Swoole.
The class that should be used is Swoole\Coroutine\MySQL
.
You can verify that using the official documentation in their GitHub repository.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install swoole
PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page