Lumen 和 DingoApi 结合,使用 swoole 所遇到的问题

在使用lumen搭建接口api的时候,由于上级领导要求并发数达到200以上,然而现在的代码只能支撑到100左右,服务器上已经做过一些优化,数据库中索引也有加,但还是达不到上级要求。
自行百度、google之后发现swoole可以加速网络请求,所以简单配置了一下。
但是遇到一个很恼火的问题。
nginx和lumen配置好之后,启动swoole,第一次访问接口,可以正常获取到数据,但是刷新之后开始报错。

"message": "Type error: Argument 1 passed to Dingo\\Api\\Http\\RateLimit\\Handler::rateLimitRequest() must be an instance of Dingo\\Api\\Http\\Request, instance of Illuminate\\Http\\Request given, called in /data/wwwroot/self-shop-api/vendor/dingo/api/src/Http/Middleware/RateLimit.php on line 64",

有没有大佬遇到过这种问题呢,我是该如何解决,请指教。
Lumen5.5、swoole4.3.0

《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 4
CrazyZard

你的传参类型错误

5年前 评论

@CrazyZard 但是如果我不用swoole的话,访问是不会报错的。

  underscores_in_headers on;
  location = /index.php {
     # Ensure that there is no such file named "not_exists" in your "public" directory.
     try_files /not_exists @swoole;
  }
  location / {
     try_files $uri $uri/ @swoole;
  }
  location @swoole {
     set $suffix "";
     if ($uri = /index.php) {
        set $suffix "/";
     }
     proxy_set_header X-Forwarded-Host $host;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header X-Forwarded-Proto $scheme;
     proxy_pass http://127.0.0.1:1215$suffix;
  }

这个是我的nginx配置,有没有可能是我配置有问题呢。

5年前 评论
CrazyZard

你是用 swoole 代替 php-fpm 来加速的?

5年前 评论

@CrazyZard 是的,并不是做即时通讯什么的。

5年前 评论

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