大家现在有啥解决好并发?

swoole貌似要收费了?另外9.1我装了好久装不上swoole,大家现在怎么解决,我现在的场景是高并发的投票,redis已经加了,队列会影响实时数据显示

《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
讨论数量: 34
李铭昕

造谣只凭一张嘴,请摆出你的证据。

不然,据说除 PHP 以为的语言,都要收费了,每个开发者每年要收100万

6个月前 评论
Runtoweb3 5个月前

这个要具体场景具体分析吧,你的这个描述只能说加缓存,异步处理,减少IO,再不济就只有加机器加配置了 :see_no_evil:

6个月前 评论

swoole 什么时候收费了? 推荐swoole-cli + hyperf3 贼爽,orm是laravel的,基本无脑上手

6个月前 评论
翟宇鑫 6个月前
douresources (作者) 6个月前

swoole有收费的必要吗,收费的话市场有那么多可选择的,搞php多都去用workman了那。

6个月前 评论

没看懂,那现在瓶颈在哪里呢?有没有尝试增大队列的消费者数量,看起来很多东西要排查才行。

6个月前 评论

swoole收费? 在哪里看到的?

6个月前 评论
meows 6个月前
mrpzx001 (作者) 5个月前

谢邀,特意注册来喷,开源项目怎么收费?你把开源代码clone 下来他怎么收费?打车去你家敲门,不给钱就删你硬盘代码?!

6个月前 评论
李铭昕

造谣只凭一张嘴,请摆出你的证据。

不然,据说除 PHP 以为的语言,都要收费了,每个开发者每年要收100万

6个月前 评论
Runtoweb3 5个月前

你这个是谣言,已经问了Swoole作者。

file

6个月前 评论
Oraoto 5个月前

额。。。事情是这样的,我的安装了swoole扩展以后,composer require swooletw/laravel-swoole就一直报错:

sh-4.2# composer require swooletw/laravel-swoole
PHP Deprecated:  Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///www/server/php/80/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112

Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///www/server/php/80/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///www/server/php/80/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///www/server/php/80/bin/composer/src/Composer/Repository/ArrayRepository.php:277
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///www/server/php/80/bin/composer/src/Composer/Repository/ArrayRepository.php:277
Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///www/server/php/80/bin/composer/src/Composer/Repository/ArrayRepository.php:277
Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///www/server/php/80/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48
Deprecation Notice: Return type of Composer\Repository\CompositeRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///www/server/php/80/bin/composer/src/Composer/Repository/CompositeRepository.php:180
Segmentation fault

然后我就去查原因,就查到了https://learnku.com/articles/47250这个文章,高赞回复说了商业化,也提到了open swoole,然后不就上来疑问了??大家跑题了,我是问解决高并发的方案。。。。

6个月前 评论
ononl 6个月前
梦想星辰大海 6个月前
李铭昕 6个月前
wongvio (作者) (楼主) 6个月前
青春不留白 6个月前
哪吒的狗腿子 6个月前
九霄道长

投票压力不是给到数据库的吗

6个月前 评论

你还是没说你的瓶颈在哪里,是代码执行慢了?是机器连接少了?宽带低了?数据库顶不住了?你说用了队列,那就大概是数据库顶不住的问题啊,和开发语言什么关系?你就是用c语言,数据库还是顶不住啊。

6个月前 评论

加配置 加机器 就行

6个月前 评论

具体问题具体分析,如上面几个老哥说的,为什么需要处理并发,是因为有大数据提交导致数据库顶不住压力,还是因为同时操作导致锁表,还是系统的处理响应速度慢了?其实并发的压力基本上都是在数据库的IO上,因此需要减轻数据库的压力:分表、分库、队列、读写分离都可以尝试一下。 在lphp里,可以使用队列,排队去消费,并且集中批量处理,或者使用redis的哈希表(数据库中进行分表,例如分0-9一共10个表)去接收提交的数据,不同的哈希表对应不同的数据表,然后分批批量处理(如果一个个插入数据库效率不高)。 在Go里,那就更简单了,队列+协程,或者管道+协程,也是分批、批量处理的操作。

6个月前 评论
Jyunwaa

Swoole一直都是开源免费的,建议修改帖子内容,有误解诱导性。

Redis不等于高并发,实际上算上IO成本,Redis跟MySQL的性能拉不开一倍。

6个月前 评论

你为啥要用laravel swoole 第三方库,不使用laravel 框架官方加速引擎呢?
已经迭代有2年半了,版本都发81个了 github.com/laravel/octane

6个月前 评论

学习swoole或是workerman困难的话可以看看这个
zhuanlan.zhihu.com/p/637624511
www.bilibili.com/video/BV1Dj411d7G...

swoole不会收费的 收费也只是官方的那几个商业项目收费 swoole 还要继续开源扩大影响力呢

5个月前 评论
GDDD

webman你值得拥有

5个月前 评论

建议看看hyperf 框架,部分业务抽离出来使用协程处理

5个月前 评论

是持续的并发,还是短时的并发呢,具体并发的峰值是多少呢。不同的并发有不同的解决方法

5个月前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!