Comments (3)
Hi @chinawilon ,
First, workers cannot share one app container because they are in different processes.
To create(load) a new app is to ensure the original container will not be affected in the request. If anyone did something strange in the request process, for example, unsetting some essential singleton properties, that might cause the whole application crashed.
from laravel-swoole.
hi @albertcht
感谢你的回答,但是我依然有个疑问。
从Swoole Structure 的这张图可以看出,如果一开始application就在master进程里面,那么它将会复制一份到manager进程,然后manager在fork新的worker进程的时候,同样也会复制一份最原始的那个application,我们知道父子进程之间的内存遵守COW(写时复制), 那也就是说,不管request请求里面如何改变application,都不会影响到manager进程里面的application。也就是说新的worker同样会得到最原始的那个application。不知道是不是我理解错了,还请求指教下。
from laravel-swoole.
Hi @chinawilon ,
目前一個 worker 中會含有:一個主架構用的 container,一個 laravel application,每次處理請求時會由 laravel application 經由 sandbox clone 出一份新的 application 去給 http kernel 處理,這個時候 request 過程中會有可能對 laravel application 中預先綁定的 singleton 進行污染,但是 container 無論如何是被隔離開來,在 request 中碰不到的,因此可以確保程式的穩定性
雖說新的 worker 可以獲得一份新的 application,但關鍵點就在於 worker 不會在處理一次請求後就被幹掉重新由 manager 再 fork 一份出來,一個 worker 會被預期處理至少上千個以上的請求,所以以上的情況就會存在
from laravel-swoole.
Related Issues (20)
- streamDownload not working and sometimes also throw "allowed memory size ... exhausted" HOT 2
- high latency after loop
- can a controller run out swoole HOT 1
- Err in line 8 of tests/fixtures/bootstrap/app.php
- Auth user problem on web socket connection HOT 1
- auth user class redis not fund
- [Question] How to change default base_path so file upload $directory will be default on public folder rather than the root laravel folder? HOT 2
- Socket.io client not work with Websockets implementation out of box
- timer
- 调用chatgpt的流式响应输出有问题 HOT 1
- 为什么在使用websocket服务时,触发on connect回调的时候发送消息给指定userid的人,自己也会收到消息 HOT 1
- facades are not safe to use inside coroutine for sure in this package. HOT 1
- swoole HOT 1
- 响应时间较长的接口出现504或者502,后台程序则依然正常执行
- how to make views folder uploaded on ram ?
- Will it support laravel 11.x in future? HOT 2
- sock instead of webhost
- please update for predis
- option "open_tcp_nodelay" dont work
- (ERRNO 9101): worker exit timeout, forced termination
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-swoole.