Giter VIP home page Giter VIP logo

Comments (3)

onanying avatar onanying commented on June 30, 2024 1
  1. 首先 mix 现在是采用的阻塞同步模式,在这种模式中,一个请求只会在同一个进程,只有在 onRequest 结束后,这个进程才能接收其他请求,而 mix 的组件都有实现 onRequestStart onRequestEnd 事件,组件会在这两个事件中清理类属性的值,所以没有变量污染问题,反而,因为是全局变量,组件常驻于内存,无需初始化,才有比其他框架高很多的性能。
  2. 当 mix 开启协程时 (我还在开发),一个进程会同时处理N个请求,这个时候组件就会有变量污染问题了,但是我为组件开发了协程隔离机制,会在不同的协程内生成不同的组件,但用户确感知不到,因为使用的方法与阻塞同步不变,所以你就会有上面的这种困惑。

from mix.

52fhy avatar 52fhy commented on June 30, 2024

@onanying 感谢您的耐心解答。对于第一点,我看到swoole是基于epoll实现IO复用的,那么同一个进程里接收多个客户端请求,这时候其实也是阻塞执行的?可以这么理解吗?然后第二点这个特性很期待!

from mix.

52fhy avatar 52fhy commented on June 30, 2024

@onanying 感觉想明白了:epoll属于同步非阻塞,所以swoole里单个进程内部依然是同步非阻塞。只要记得把用过的全局变量清理掉,就不会有变量污染问题。这么说来MixPHP运行在php-fpm和swoole里,都是同步方式的。

from mix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.