zoukankan      html  css  js  c++  java
  • 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

    验证效果

  • 相关阅读:
    Do You See Me? Ethical Considerations of the Homeless
    ELDER HOMELESSNESS WHY IS THIS AN ISSUE?
    Endoflife support is lacking for homeless people
    html内联框架
    html字体
    html块 div span
    html列表
    html表格
    SQL Server管理员专用连接的使用   作为一名DBA,经常会处理一些比较棘手的服务无响应问题,鉴于事态的严重性,多数DBA可能直接用“重启”大法,以便尽快的恢复生产环境的正常运转,但是多数情况
    如何配置最大工作线程数 (SQL Server Management Studio)
  • 原文地址:https://www.cnblogs.com/luoahong/p/12409545.html
Copyright © 2011-2022 走看看