首页
Search
1
v2ray异常错误之二
3,310 阅读
2
linux时区设置
2,698 阅读
3
DB2常用操作
2,173 阅读
4
websphere修改jvm内存xmx和xms
1,929 阅读
5
nfs客户端文件属主为nobody的现象
1,552 阅读
技术
生活
运动
游戏
电影
登录
Search
标签搜索
docker
linux
troubleshooting
nginx
secure
truenas
mysql
windows
python
esxi
docker swarm
oracle
zabbix
tomcat
blog
dsm
群晖
rpa
freenas
db
yuc
累计撰写
291
篇文章
累计收到
0
条评论
首页
栏目
技术
生活
运动
游戏
电影
页面
搜索到
289
篇与
的结果
2022-06-15
nginx更换默认内存分配器为jemalloc
0x1 虽然nginx的性能很高,但是在互联网高并发的场景下长期运行,仍然需要尽可能提升其性能/保持稳定,那么修改默认内存分配器glibc为jemalloc是一个不错的选择 0x2 nginx的默认内存分配器,通过以下命令做了简单的判断: lsof | grep nginx # 无malloc相关的内容 strings ./nginx # 有malloc关键字,但是无明显jemalloc或者tcmalloc ldd ./nginx # 无malloc相关的内容 通过以上内容,我们无法判断nginx显示使用了jemalloc或者tcmalloc,那么应该是使用了linux默认的glibc的内存分配器 0x3 nginx使用jemalloc的前提是安装了jemalloc,这里不再重复说明。要想更换为jemalloc,仅增加编译参数: --with-ld-opt="-ljemalloc" 0x4 确定已经使用jemalloc。启动nginx,执行如下命令,保证回显有jemalloc关键字 lsof | grep nginx
2022年06月15日
829 阅读
0 评论
0 点赞
2022-06-15
jemalloc的安装
安装依赖 yum -y install autoconf make 下载jemalloc并且编译安装 https://github.com/jemalloc/jemalloc/releases tar -xf jemalloc-x.x.x.tar.bz2 cd jemalloc-x.x.x ./configure --prefix=/usr/local/jemalloc --libdir=/usr/local/lib make && make install make clean cd ../ echo "/usr/local/lib" >/etc/ld.so.conf.d/usr_local_lib.conf /sbin/ldconfig
2022年06月15日
1,022 阅读
0 评论
0 点赞
2022-06-14
redis的内存分配器
0x1 redis的内存分配器默认是jemalloc。需要查看的话,在启动redis显示日志是没有提示的,但是启动后登录redis的cmd,然后使用以下命令可以确认: 命令一: INFO # INFO 命令的内容有很多,但是可以关注Memory这部分,显示的提示了当前的内存分配器版本 127.0.0.1:7001> INFO ... mem_cluster_links:0 mem_aof_buffer:8 mem_allocator:jemalloc-5.2.1 active_defrag_running:0 lazyfree_pending_objects:0 lazyfreed_objects:0 ... 命令二: MEMORY MALLOC-STATS # 此命令也会显示提示内存分配器版本 127.0.0.1:7001> MEMORY MALLOC-STATS ___ Begin jemalloc statistics ___ Version: "5.2.1-0-g0" ... --- End jemalloc statistics --- 方式三:查询打开文件 # 能够显示使用的jemalloc分配器 lsof | grep redis 0x2 为什么要使用jemalloc呢,应该是性能更高吧,目前默认malloc在jvm上有可能导致内存不释放的问题
2022年06月14日
921 阅读
0 评论
0 点赞
2022-06-13
相同内容文件压缩后md5校验值不同的问题
0x1 奇怪的问题 一般我们经常使用md5来校验文件一致性,大多数时候都没有问题。但是最近在做压缩测试,想确认文件有无问题,先cp -a复制了一份目录为备份文件,再把两个目录使用相同命令压缩,校验md5却发现值不同 [root@localhost 123]# du -sb * 117569124 mat 75331667 mat.tar.gz 117569124 mmm 75333283 mmm.tar.gz [root@localhost 123]# ls -l total 147152 drwxrwxr-x 7 root root 4096 Jul 16 2021 mat -rw-r--r-- 1 root root 75331667 Jun 13 17:02 mat.tar.gz drwxrwxr-x 7 root root 4096 Jul 16 2021 mmm -rw-r--r-- 1 root root 75333283 Jun 13 17:03 mmm.tar.gz [root@localhost 123]# stat *gz File: ‘mat.tar.gz’ Size: 75331667 Blocks: 147144 IO Block: 4096 regular file Device: 803h/2051d Inode: 1853497 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2022-06-13 17:03:11.688382823 +0800 Modify: 2022-06-13 17:02:56.342809111 +0800 Change: 2022-06-13 17:02:56.342809111 +0800 Birth: - File: ‘mmm.tar.gz’ Size: 75333283 Blocks: 147144 IO Block: 4096 regular file Device: 803h/2051d Inode: 1853498 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2022-06-13 17:03:11.878389933 +0800 Modify: 2022-06-13 17:03:07.281218061 +0800 Change: 2022-06-13 17:03:07.281218061 +0800 Birth: - [root@localhost 123]# md5sum *gz e50a6873bbda5495395ca2bb810a01dc mat.tar.gz f087a1e58d12e2df5794126259b43ad5 mmm.tar.gz 可以看到复制目录和原目录本来大小是一致的,但压缩后大小不一样了,md5值变了 0x2 进一步测试 根据上面的问题,我们先后压缩同一份目录发现也可以复现,经过网上搜索后发现是跟时间有关系,目录access时间不同导致最后压缩后文件md5不一致,但是更有趣的是压缩过程会修改access的时间,导致每次打包后md5值都不一样
2022年06月13日
1,548 阅读
0 评论
0 点赞
2022-06-13
nginx做文件服务器的优化
背景 目前大部分浏览器已经不支持ftp协议了,win11也移除了支持ftp的ie,那么现在使用ftp有几个方案: 使用资源管理器,但界面看起来就不太舒服了 使用cmd匿名登录或者wget下载指定文件,浏览文件不方便 使用第三方工具登录ftp或者下载ftp文件,浏览文件不方便 解决 其实下载ftp和查看ftp文件都还是支持的,只是更好的观赏性和便利性已经不支持了。而且ftp的重要功能是上传,对于内网大部分的用户而言他们都不需要上传,所以我们新增一个http协议吧,让下载/浏览/便利重新回归,此次使用nginx的文件下载功能。 nginx文件下载 nginx最小化的编译安装也是支持文件下载的,参数如下: server { listen 80; location / { autoindex on; root html; } } 这个配置满足了文件下载功能,但是有几个问题:中文文件名乱码,文件名超过一定字符显示不完整,再就是不够美观。所以采用开源模块fancy来解决此文件。 优化 fancy主体,此模块编译进nginx https://github.com/aperezdc/ngx-fancyindex 主题优化代码 https://github.com/TheInsomniac/Nginx-Fancyindex-Theme 安装后更新为如下代码: # 其中主题解压到了/var/ftp/pub/fancyindex,其他方法貌似访问有问题 # 前面三个参数功能nginx默认是支持的,把fancy改成auto就行了 server { listen 80; charset utf-8,gbk; location / { fancyindex on; fancyindex_localtime on; fancyindex_exact_size off; fancyindex_name_length 500; fancyindex_header "/fancyindex/header.html"; fancyindex_footer "/fancyindex/footer.html"; fancyindex_ignore "fancyindex"; alias /var/ftp/pub/; } }
2022年06月13日
744 阅读
0 评论
0 点赞
1
...
48
49
50
...
58