学习swoole或是workerman困难的话可以看看这个
zhuanlan.zhihu.com/p/637624511
www.bilibili.com/video/BV1Dj411d7G...
swoole不会收费的 收费也只是官方的那几个商业项目收费 swoole 还要继续开源扩大影响力呢
具体问题具体分析,如上面几个老哥说的,为什么需要处理并发,是因为有大数据提交导致数据库顶不住压力,还是因为同时操作导致锁表,还是系统的处理响应速度慢了?其实并发的压力基本上都是在数据库的IO上,因此需要减轻数据库的压力:分表、分库、队列、读写分离都可以尝试一下。 在lphp里,可以使用队列,排队去消费,并且集中批量处理,或者使用redis的哈希表(数据库中进行分表,例如分0-9一共10个表)去接收提交的数据,不同的哈希表对应不同的数据表,然后分批批量处理(如果一个个插入数据库效率不高)。 在Go里,那就更简单了,队列+协程,或者管道+协程,也是分批、批量处理的操作。
额。。。事情是这样的,我的安装了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
,然后不就上来疑问了??大家跑题了,我是问解决高并发的方案。。。。
推荐文章: