当前位置:网站首页>基于memcache的缓存机制的6个指令
基于memcache的缓存机制的6个指令
2022-07-26 20:36:00 【星哥玩云】
Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载。它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高动态、数据库驱动网站的速度。Memcached基于一个存储键/值对的hashmap。其守护进程(daemon )是用C写的,但是客户端可以用任何语言来编写,并通过memcached协议与守护进程通信。
主要功能:
- 服务器参数监控:STATS、SETTINGS、ITEMS、SLABS、SIZES实时刷新
- 服务器性能监控:GET、DELETE、INCR、DECR、CAS等常用操作命中率实时监控
- 支持数据遍历,方便对存储内容进行监视
- 支持条件查询,筛选出满足条件的KEY或VALUE
- 数组、JSON等序列化字符反序列显示
- 兼容memcache协议的其他服务,如Tokyo Tyrant (遍历功能除外)
- 支持服务器连接池,多服务器管理切换方便简洁
在Nginx服务器的标准HTTP模块中有一个ngx_http_memcached_module模块,专门用于处理和memcached相关的配置和功能实现,
1, memcached_pass
用于配置memcached服务器的地址
memcached_pass adress;
其中address 为memcached服务器的地址,支持IP+端口或者域名地址,也可以使用upstream指令配置一个memcacched服务器组,然后配置为upstream的名称
2, memcached_connect_timeout
用于配置连接memcached服务器的超时时间,
memcached_connect_timeout time;
time未设置的超时时间,默认为60,建议不要超过75;
3, memcached_read_timeout
配置Nginx服务器向memcached服务器发出两次read请求之间的等待超时时间,如果在该事件没有惊醒数据传输,连接将会关闭
memcached_read_timeout time;
默认时间60
4 memcached_send_timeout
用于配置Nginx服务器向memcached服务器发出两次write请求之间的等待超时时间,如果在该事件没有惊醒数据传输,连接将会关闭
5 memcached_buffer_size
用于配置Nginx 服务器用于接收memcached服务器响应数据的缓存区大小
memcached_buffer_size size
size 为设置的缓存区大小,一般时所在的平台的内存也的大小背书
memcached_buffer_size 4K|8K
6, memcached_next_upstream 指令
用于配置了一组memcached服务器的情况下使用,服务器组中个memcached服务器的访问规则遵循upstream指令配置的轮询规则,同时可以使用该指令配置在发生那些异常情况时,将请求顺次加油下一个组内地而服务器处理
memcached_next_uptream status ...
其中, status 未设置的memcached服务器返回状态,可以是多个
error 在建立连接,向memcached服务器发送请求或者读取响应头时服务器发生错误
timeout 在建立连接,向memcached服务器发送请求或者读取相应头时服务器发生连接超时
incalid_header, memcached 服务器返回的响应头为空或者无效
not_found, memcached 服务器未找到对呀的键/值对
off 无法将请求发送给memcache服务短
边栏推荐
- Valley segment coverage - (summary of interval sequencing problem)
- Deployment of kubernetes
- 25张炫酷交互图表,一文入门Plotly
- Set the template of core configuration file in idea
- encodeURI VS encodeURIComponent
- [HCIA security] user authentication
- Props with type Object/Array must...
- 【音视频】ijkplayer播放器参数说明文档
- 在上传之前预览图像
- TypeScript中的类型断言
猜你喜欢

除了「加机器」,其实你的微服务还能这样优化

Retrieve the parameters in this method in idea for our use -- 1. Class diagram. 2. Double click shift
HTTP cache browser cache that rabbits can understand

Practice of microservice in solving Library Download business problems

【HCIA安全】双向NAT

微服务化解决文库下载业务问题实践

idea中检索此方法中有哪些参数以便我们使用——1.类图。2.双击shift

How to enter the specified user method body when debugging in idea?

Mobile phone \ landline call forwarding setting method

Redis hash和string的区别
随机推荐
Summary of common interview questions of computer composition principle, including answers
Some unexpected bug records
牛客多校-Journey-(建图distra+卡常优化)
Error in render: “TypeError: data.slice is not a function“
[Oracle training] - deploy Ogg known as zero downtime migration
encodeURI VS encodeURIComponent
Practice of microservice in solving Library Download business problems
今天公司碰到一个阿里p8,算是真正见识到了基础的天花板
Set the template of core configuration file in idea
[HCIA security] bidirectional nat
测试用例千万不能随便,记录由一个测试用例异常引起的思考
Drag and drop table rows
How to enter the specified user method body when debugging in idea?
[HCIA security] NAT network address translation
串口通信失败
如何在一个项目中使用多种不同的语言?
滤波及失真
Multivariable time series prediction using LSTM -- problem summary
MySQL -count: the difference between count (1), count (*), and count (column name)
Live broadcast appointment award | senior consultant xuyanfei: how does efficiency measurement help efficient and sophisticated outsourcing management