pika icon indicating copy to clipboard operation
pika copied to clipboard

[Pika 3.3.6] SETEX 命令出现很多慢查询日志

Open luky116 opened this issue 2 years ago • 4 comments

pika 版本: 3.3.6

错误日志如下:

E0711 10:36:18.189824 47606 pika_client_conn.cc:158] ip_port: xx.xx.xx.xx:port, table: db0, command: "SETEX" "rr_cache_m_result_2.0_\xe5\xbf\xab" "259200" "{"data":[{"data":[{"href":"","imgsrc":"http:/244.png","title":"\xe5\xbf\xab \xe6\x89\x8b"},{"href":"","imgsrc":"http/t01ce3bfcc355ced8e6.jpg","title":"\xe5\xbf\xab\xe6\x89\x8b\xe6\x9e\x81\xe9\x80\x9f\xe7\x89\x88"},{"href":"","imgsrc":"http://t014acf28ba129faf32.png","title":"\xe6\x8a\x96\xe9\x9f\xb3"},{"href":"","imgsrc":"http://p011ca9f69fb9679e60.jpg","title":"\xe5\xbc\x80"},{"href":"","imgsrc":"http:/t01e70aa375558bbefb.jpg","title":"\xe6\x9c\xac"},{"href":"","imgsrc":"http:/48b79d2c488e80dc.jpg","title":"\xe7\x9b\xb4\xe6\x8e\xa5"},{"href":"","imgsrc":"http://t017ebc6741aea3cb96.jpg","title":"\xe6\x8e\xa8\xe8\x8d\x90"},{"href":"","imgsrc":"http://t0114c0174fdc2f0eff.png","title":"\xe7\x99\xbe\xe5\xba\xa6...", command_size: 2720, arguments: 4, start_time(s): 1689042975, duration(us): 2362797 E0711 10:36:18.229825 47603 pika_client_conn.cc:158] ip_port: xx.xx.xx.xx:port, table: db0, command: "SETEX" "rr_cache_result_2.0_\xe7\x88\xb1\xe5\xa5\x87\xe8\x89\xba\xe5\x9c\xa8\xe7\xba\xbf\xe8\xa7\x82\xe7\x9c\x8b" "259200" "{"add_src":"eci=&nlpv=gaia_zzzc_c","data":[{"list":[{"clicklevel":"","hot_rank_entry":"","init_line":"2","list":[{"href":"","imgsrc":"http://t01bb555e1a78c58353.jpg","title":"\xe6\xb1\xaa\xe6\xb1\xaa\xe9\x98\x9f\xe7\xab\x8b\xe5\xa4\xa7\xe5\x8a\x9f"},{"href":"","imgsrc":"http://t01bde6f44ae20cf5c3.jpg","title":"\xe6\xb5\xb7\xe5\xba\x95\xe5\xb0\x8f\xe7\xba\xb5\xe9\x98\x9f\xe7\xac\xac\xe5\x85\xad\xe5\xad\xa3"},{"href":"","imgsrc":"http:/99c.jpg","title":"\xe5\x96\x9c\xe7\xbe\x8a\xe7\xbe\x8a\xe4\xb8\x8e\xe7\x81\xb0\xe5\xa4\xaa\xe7\x8b\xbc\xe4\xb9\x8b\xe7\xbe\x8a\xe6\x9d\x91\xe5\xae\x88\xe6\x8a\xa4\xe8\x80\x85"},{"href":"","imgsrc":"http://p8215e29d42a42fa.jpg","title":"\xe5\xa5\x94\xe8\xb7\x91\xe5\x90\xa7\xe5\x85\x84\xe5\xbc\x9...", command_size: 6638, arguments: 4, start_time(s): 1689042975, duration(us): 2361957 E0711 10:36:18.268687 47613 pika_client_conn.cc:158] ip_port: 10.172.193.184:30702, table: db0, command: "SETEX" "q_feedback_fb_local_v201212wmwbWl9lYXN5Lmluay8pX+aKlumfs+WcqOe6v+ingueci+e9kemhteWFpeWPow==" "604800" "0.0,0.0,3,0,13,0", command_size: 188, arguments: 4, start_time(s): 1689042975, duration(us): 2362917

luky116 avatar Jul 11 '23 02:07 luky116

暂时未复现

luky116 avatar Sep 02 '23 11:09 luky116

352环境上依然存在 chejinge跟进

chejinge avatar Dec 06 '23 10:12 chejinge

主要是下面这几个点: 1 网络层 & proxy:长链接超时探测、常驻内存 buffer配置、tcp等待队列、剔除不可用节点的探测时间。 2 compaction:改了一些rocksdb的参数:max_bytes_for_level_base target_file_size_multiplier level0_file_num_compaction_trigger max_background_compactions, 并且调整了全量 compaction的周期 3 压缩: 调了一些snappy 的压缩等级 4 write buffer相关的参数: 这个就是max_write_buffer_size 之类的了 另外有一个比较值得关注的点 是减少小文件的频繁合并可以让磁盘利用更充分、iops 也更好看一些

chejinge avatar Dec 07 '23 08:12 chejinge

广坤回复:pika写入用mmap的问题,我网上也找了下。国外说的不如fwrite。你们看看,说是用mmap并不会提升性能,反而会导致性能更差。我这边setex慢就是这问题。 https://stackoverflow.com/questions/35891525/mmap-for-writing-sequential-log-file-for-speed

AlexStocks avatar May 14 '24 07:05 AlexStocks