GithubHelp home page GithubHelp logo

长连接问题 about mix HOT 3 CLOSED

mix-php avatar mix-php commented on August 21, 2024
长连接问题

from mix.

Comments (3)

onanying avatar onanying commented on August 21, 2024

你测试一下就能知道了,上面你提到的两种方式是传统方式,是fpm/apache这种方式由fpm/apache帮php实现的,而swooleHttpServer则是一个常驻执行的CLI程序,也就是说,任何client连接如果你不主动去关闭,都是长连接。

from mix.

52fhy avatar 52fhy commented on August 21, 2024

@onanying 您好,redis连接有些疑问:
框架里我看了是根据抛异常重新连接,那么问题如下:
1、 连接超时的情况,会等待几秒钟才抛异常,如果这时候刚好有大量访问,会引发很大的问题;
2、异常里检测用的字符串好像并不全,例如read error on connection这种就没有。
3、ping()是否也可以加入到检测里面:每次获取redis对象时,除了判断是否为null,使用ping命令看看返回值是否是+PONG,不是的话也重连下。

from mix.

onanying avatar onanying commented on August 21, 2024

@52fhy
第一种情况,redis已经出现问题,在任何框架搭建的系统中,都会引发很大的问题,
第二种情况,所以需要大家一起来完善,参与到开源当中来
第三种情况,当连接被数据库主动断开时,ping是调用不了的,直接会报错,而且那种实现方式并不通用,连接保持我做过多种尝试,现在这种才是最简单实用的,与TP5一至。

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.