随笔分类 -  http&server&业务

http Server 四层 七层 udp 业务
摘要:https://www.cnblogs.com/codestack/p/11254178.html 之前转载的一片文章 简述了linux 信号 当一个进程有多线程的时候,信号处理应该怎么办? 同一个进程下的所有线程共享 信号的处理方式,所以一个线程改变对信号的处理方式,所有线程如果收到该信号都会是那 阅读全文
posted @ 2021-04-19 21:49 codestacklinuxer 阅读(261) 评论(0) 推荐(0)
摘要:开始优化应用层!! 目前可以看出问题如下: select 耗时太多!!!! read 系统调用的errors次数占比13% 这是一个问题 read的次数太多,是不是可以调大接收缓存减少read 次数,同时使用zero_copy tcp : A reworked TCP zero-copy recei 阅读全文
posted @ 2021-04-17 15:53 codestacklinuxer 阅读(115) 评论(0) 推荐(0)
摘要:收集整理质料如下: 1:网卡硬件-->2 内核缓存队列-->3协议层 >4用户recv使用的buff 转载:https://zhuanlan.zhihu.com/p/52397230 net.core.optmem_max = 20480 net.core.rmem_default = 229376 阅读全文
posted @ 2021-01-18 16:49 codestacklinuxer 阅读(185) 评论(0) 推荐(0)
摘要:https://www.w3.org/Protocols/rfc2616/rfc2616 https://www.w3.org/Protocols/rfc1945/rfc1945 https://www.w3.org/Protocols/HTTP/AsImplemented.html 阅读全文
posted @ 2020-12-18 16:16 codestacklinuxer 阅读(69) 评论(0) 推荐(0)
摘要:copy from https://www.cnblogs.com/xuanyuan/p/12710715.html https://files.cnblogs.com/files/codestack/nginx%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90%E5%85%A 阅读全文
posted @ 2020-12-07 22:42 codestacklinuxer 阅读(362) 评论(0) 推荐(0)
摘要:client-- proxy server; 四次挥手走完, client 发出syn ,proxy 代理发出syn后,收到 server的ack后就发出了rst。 分析报文特征如下:proxy的syn的seq ()大于 server回复ack的seq? 为什么会出现这样的问题呢? 说到这个问题,就 阅读全文
posted @ 2020-11-27 20:46 codestacklinuxer 阅读(389) 评论(0) 推荐(0)
摘要:代理服务器在代理结局后肯定会面临一个关闭链接的问题;那么代理服务器关闭连接时,需要考虑什么呢? 目前认为需要考虑点如下: 单向链接: read/write 事件超时定时器 read/write 事件posted等待延时处理链表 I/O复用模型 del fd from epoll close fd 以 阅读全文
posted @ 2020-11-23 19:34 codestacklinuxer 阅读(260) 评论(0) 推荐(0)
摘要:回到ngx_http_upstream_send_response,如果是buffering,就会进入后面的处理过程,准备一个ngx_event_pipe_t结构的数据,这个结构可以通过upstream的u->pipe进行索引找到。首先设置p->output_filter输出过滤函数为ngx_htt 阅读全文
posted @ 2020-11-11 22:31 codestacklinuxer 阅读(177) 评论(0) 推荐(0)
摘要:在如下网络层面下,代理(比如Envoy nginx )执行额外的L7策略(Health checks, service discovery, load balancing, mutual TLS),其开销比较大,主要体现在传统的TCP/IP协议栈路径比较冗余,导致其开销比较大;就像同一主机上unix 阅读全文
posted @ 2020-11-07 13:15 codestacklinuxer 阅读(852) 评论(0) 推荐(0)
摘要:通过代理服务器在两个TCP接连之间转发数据是一个常见的需求,然后通常部署的时候涉及到(虚拟)服务器、真实服务器、防护设备。涉及到多个ip地址相关联,改动一个IP就需要修改配置。 比如反向服务器部署的时候, 真实服务器ip 改动就会联动反向代理关系改动,比较麻烦。所以当然是将真实服务器Ip 对外最好, 阅读全文
posted @ 2020-11-06 18:26 codestacklinuxer 阅读(317) 评论(0) 推荐(0)
摘要:读ngx 的一个问题? //这里应该再重新接收一次和NGINX一样,等待下一次循环(epoll)再进行,同时设置读写句柄,以便下次读取的时候直接进行握手 //单向认证四次握手过程还没有完成,需要继续握手 if (sslerr == SSL_ERROR_WANT_READ) { //# define 阅读全文
posted @ 2020-10-30 18:55 codestacklinuxer 阅读(132) 评论(0) 推荐(0)
摘要:if (c->read->ready) { ngx_http_upstream_process_header(r, u); //读事件触发 准备处理http头部信息 return; } 向上游服务器发送数据完毕后就会检测是否收到上游服务器的响应: static void ngx_http_upstr 阅读全文
posted @ 2020-10-30 18:54 codestacklinuxer 阅读(187) 评论(0) 推荐(0)
摘要:每次客户端有可读数据触发时,优先检测是否还有数据没有发送,如果有则发送数据,然后在读取client数据 //向后端发送请求的调用过程 //ngx_http_upstream_send_request_body->ngx_output_chain->ngx_chain_writer static ng 阅读全文
posted @ 2020-10-29 16:56 codestacklinuxer 阅读(123) 评论(0) 推荐(0)
摘要:向上游服务器发送请求处理 static void ngx_http_upstream_send_request(ngx_http_request_t *r, ngx_http_upstream_t *u, ngx_uint_t do_write) //向上游服务器发送请求 当一次发送不完,通过ngx 阅读全文
posted @ 2020-10-29 16:37 codestacklinuxer 阅读(110) 评论(0) 推荐(0)
摘要:代理模式数据流处理: //配置proxy_pass后,在 ngx_http_core_content_phase 里面指向该函数 /* 那么,当有请求访问到特定的location的时候(假设这个location配置了proxy_pass指令), 跟其他请求一样,会调用各个phase的checker和 阅读全文
posted @ 2020-10-29 14:38 codestacklinuxer 阅读(146) 评论(0) 推荐(0)
摘要:转载:https://initphp.blog.csdn.net/article/details/51911189 一、Nginx的配置文件nginx.conf Nginx的配置文件每一行就是一条命令。 最外层的为核心模块的配置参数(类型:NGX_CORE_MODULE);内部嵌套的为各个子模块的配 阅读全文
posted @ 2020-09-30 10:32 codestacklinuxer 阅读(271) 评论(0) 推荐(0)
摘要:ngx_init_cycle for (i = 0; ngx_modules[i]; i++) { if (ngx_modules[i]->type != NGX_CORE_MODULE) { continue; } module = ngx_modules[i]->ctx; if (module- 阅读全文
posted @ 2020-09-27 10:29 codestacklinuxer 阅读(190) 评论(0) 推荐(0)
摘要:使用工具有: top看进程的状态: R(Running), D(Disk sleep), Z(zombie), S(Interruptible sleep), I(Idle), T(stopped), t(Traced)以及 cpu 、mem、inter 等信息 vmstat:整体cpu 性能 中断 阅读全文
posted @ 2020-09-03 23:31 codestacklinuxer 阅读(143) 评论(0) 推荐(0)
摘要:根据perf 工具可以看到目前引擎问题主要是: 内核协议栈以及软中断问题;细分的话 就是 自旋锁、cache-misses、cs 进程上下文切换 1、应用层目前预计只能从数据结构优化; 比如使用haproxy的ebtree经行优化。但是 我们使用了fdtable ,所以无用。ebtree(见http 阅读全文
posted @ 2020-09-02 22:07 codestacklinuxer 阅读(669) 评论(0) 推荐(0)
摘要:今天在新入职的公司处理waf 的问题时,突然看到了一个tcp状态close-wait 想一想 close-wait 是怎样产生的???? 被动收到FIN 关闭请求,协议栈主动发出ACK, 等待 本端主动发出 FIN,但是本端一直没有执行CLOSE。也就是在被动关闭连接情况下,在已经接收到FIN,但是 阅读全文
posted @ 2020-08-28 23:39 codestacklinuxer 阅读(203) 评论(0) 推荐(0)