Basics:

1. Ensure that you have not disabled Lua code cache:
https://github.com/openresty/lua-nginx-module#lua_code_cache

2. Load resty.core:
https://github.com/openresty/lua-resty-core#synopsis

3. Check that you are using Redis connection pools:
do not call this: https://github.com/openresty/lua-resty-redis#close
call this: https://github.com/openresty/lua-resty-redis#set_keepalive

4. Use unix sockets instead of TCP sockets if possible (e.g.. Redis is on the same machine)

5. Use Redis pipelines:
https://github.com/openresty/lua-resty-redis#init_pipeline

6. Cache Redis data in OpenResty shared dict and also to Lua module level (preload data in init_*s):
https://github.com/openresty/lua-nginx-module#lua_shared_dict
https://github.com/openresty/lua-nginx-module#ngxshareddict
https://github.com/openresty/lua-resty-lrucache

(there are some projects like https://github.com/hamishforbes/lua-resty-tlc that might come handy).

... and also make look for adjusting Nginx confs and Kernel settings.

相关文章:

  • 2021-11-17
  • 2021-09-22
  • 2021-11-27
  • 2022-12-23
  • 2021-12-21
  • 2021-04-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-07
  • 2021-05-18
  • 2021-09-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案