openresty 静态库_Nginx核心知识100讲学习笔记(陶辉)Nginx架构基础(四)

一、红黑树

1、红黑树

2、红黑树复杂度

3、使用红黑树的模块

1、本地内存做的红黑树

ngx_conf_module

ngx_event_timer_rbtree #管理定时器的红黑树

2、管理定时器的红黑树

Ngx_http_file_cache

Ngx_http_geo_module

Ngx_http_limit_conn_module

Ngx_http_limit_req_module

Ngx_http_lua_shdict:ngx.shared.DICT #LRU链表性质

resolver #ngx_resolver_t

Ngx_stream_geo_module

Ngx_stream_limit_conn_module

二、使用动态模块来提升运维效率

1、动态库和静态库有什么区别?

静态库直接把所有的源代码编译到最终的二进制中

动态库在nginx可执行文件里保留了调用它的地址、在需要用到动态库的功能时由nginx的可执行文件去调用这个动态库

2、动态库的应用场景

这里的好处是:当我们仅仅需要修改某一个模块或者升级某个模块功能时、这时候我可以仅仅编译这个动态库就可以升级的时候用新的动态文件替换掉旧的动态文件即可

1、那些模块是支持动态模块的

[root@ceph-client openresty-1.13.6.2]# ./configure --help|grep "=dynamic"

--with-http_xslt_module=dynamic enable dynamic ngx_http_xslt_module

--with-http_image_filter_module=dynamic

--with-http_geoip_module=dynamic enable dynamic ngx_http_geoip_module

--with-http_perl_module=dynamic enable dynamic ngx_http_perl_module

--with-mail=dynamic enable dynamic POP3/IMAP4/SMTP proxy module

--with-stream=dynamic enable dynamic TCP/UDP proxy module

--with-stream_geoip_module=dynamic enable dynamic ngx_stream_geoip_module

3、静态模块工作原理

4、动态模块运行流程

三、动态模块安装

1、安装流程图

2、安装过程

1、Configure加入动态模块

./configure --prefix=/home/geek/nginx --with-http_image_filter_module=dynamic

2、编译进binary

make && make install

3、启动时初始化模块数组

4、读取load_module配置

load_module modules/ngx_http_image_filter_module.so;

5、打开动态库并加入模块数组

6、基于模块数组开始初始化

四、动态模块使用前后对比

1、未使用动态模块

nginx配置

location / {

root /test;

}

nginx -s reload

[root@nginx ~]# ll /test/

total 288

-rw-r--r-- 1 root root 294408 Aug 21 17:18 1.png

验证

2、使用动态模块

nginx配置

load_module modules/ngx_http_image_filter_module.so

image_filter resize 150 100;

nginx -s reload

验证效果

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值