这里讲述一下在nginx-0.8.53版本下使用本模块的具体安装方法(linux)
一、安装准备
1、下载nginx-0.8.53;
2、下载ngx_hmux_module_vx.x.tar包 (http://code.google.com/p/nginx-hmux-module/downloads/list);
这里供下载的版本是初步版本,以后会随着需求不断增强其功能。
ngx_hmux_module.c文件的实现参考了姚伟斌写的nginx_ajp_module模块,具体功能就是实现hmux协议,并把处理过程异步化。
hmux协议可以参考文档 http://www.caucho.com/resin-4.0-javadoc/com/caucho/server/hmux/HmuxRequest.html
3、(可选)
如果nginx与resin之间需要保持keepalive,且版本低于1.1.4请下载keepalive模块( http://mdounin.ru/hg/ngx_http_upstream_keepalive ),并参考http://trac.nginx.org/nginx/changeset/4116/nginx打好补丁;
如果需要session sticky,请下载ngx_http_upstream_jvm_route_module.c文件( http://yaoweibin.cn/ )。
4、为了实现过程异步,需要修改src/event/ngx_event_pipe.c文件
原来代码如下:
while (cl && n > 0) {
ngx_event_pipe_remove_shadow_links(cl->buf);
size = cl->buf->end - cl->buf->last;
if (n >= size) {
cl->buf->last = cl->buf->end;
/* STUB * / cl->buf->num = p->num++;
if (p->input_filter(p, cl->buf) == NGX_ERROR){
return NGX_ABORT;
}
n -= size;
ln = cl;
cl = cl->next;
ngx_free_chain(p->pool, ln);
} else {
cl->buf->last += n;
n = 0;
}
}
修改如下:
while (cl && n > 0) {
ngx_event_pipe_remove_shadow_links(cl->buf);
size = cl->buf->end - cl->buf->last;
if (n >= size) {
cl->buf->last = cl->buf->end;
n -= size;
} else {
cl->buf->last += n;
n = 0;
}
/* STUB */cl->buf->num = p->num++;
if (p->input_filter(p, cl->buf) == NGX_ERROR) {
return NGX_ABORT;
}
ln = cl;
cl = cl->next;
ngx_free_chain(p->pool, ln);
}
这样修改的目的就是为了让nginx及时返回信息给客户端,否则很长时间才能返回给客户端。
上述修改参考了Maxim Dounin和姚伟斌的做法。
上述也可以采用补丁的方式修改,参加下载包里面的hmux.patch和README.txt文件。
二、安装步骤
以下是加上keepalive功能的安装步骤:
1、./configure --add-module=hmux/ --add-module=keepalive/ --with-debug
2、修改objs/Makefile,去掉优化参数(调试目的)
3、make
4、make install
5、修改nginx.conf配置文件如下:
user xxx;
worker_processes 2;
debug_points abort;
error_log logs/error.log debug;
pid logs/nginx.pid;
worker_rlimit_nofile 65536;
events {
use epoll;
epoll_events 4096;
worker_connections 8192;
accept_mutex off;
}
http {
include mime.types;
default_type application/octet-stream;
access_log logs/access.log;
sendfile on;
tcp_nopush on;
client_header_timeout 5;
send_timeout 5;
keepalive_timeout 10;
server_name_in_redirect off;
server_tokens off;
charset GB2312;
upstream resins{
server xxx.xxx.xxx.xxx:6800;
keepalive 1024;
}
server {
listen xxxx;
server_name xxx.xxx.com;
location / {
hmux_pass resins;
}
}
}
三、注意
这里需要注意的几点就是:
1、一定要修改nginx源代码或者打补丁
2、在单进程模式下,keepalive模块是没有问题的,但是在多进程模式下,
按照keepalive模块内说明可能会有问题。根据我近一年使用keepalive的经验
和源代码分析,在多进程模式下要保持与后端resin的keepalive,最好设
置accept_mutex off(这个会在我以后的文档中具体讲述为什么)。
3、这里书写的文档由于是从项目中提炼出来的,如果有什么不明白的或者
错误的地方,请提出来,我们团队会尽快解决这些问题的。
相关推荐
RK3588开发板DDR频率上不去?手把手教你用ddrbin_tool降频调优(附完整配置流程)
本文详细介绍了RK3588开发板DDR频率调优的完整解决方案,重点使用ddrbin_tool工具进行降频配置。从硬件原理分析到实战操作,包括参数导出、频率调整、二进制生成及烧录验证,帮助开发者解决DDR高频不稳定问题,提升系统可靠性。适用于嵌入式开发、工业控制等场景。
nginx resin hmux性能分析
<br />下面是经过简单测试,得出的结论,仅供参考 <br /> nginx通过http访问resin: <br /> 5318.22 [#/sec] (mean) <br /> nginx通过hmux访问resin: <br /> 7050.85 [#/sec] (mean) <br /> nginx通过keepalive方式和hmux访问resin: <br /> 13152.60 [#/sec] (mean) <br />
立创·庐山派-K230-CanMV(嘉楠勘智)开发板通过ATK-ESP8266实现图像识别数据无线传输至原子云
本文详细介绍了如何使用立创·庐山派-K230-CanMV开发板,通过ATK-ESP8266 WIFI模块实现图像识别数据的无线传输至原子云平台。内容包括硬件连接、软件环境搭建、AT指令控制、原子云连接及数据上传的全过程,并提供了实用的调试技巧和常见问题解决方案,为物联网应用开发提供了完整实践指南。
Nginx通过hmux协议访问resin说明文档
线上nginx编译参数如下: nginx.conf的配置文件有一段 解析: 2、下载ngx_caucho_vx.x.tar包,解开后包含两个文件:config和ngx_caucho.c; 这里供下载的版本是初步版本,以后会随着需求不断增强其功能。 ngx_caucho.c文件的实现参考了姚伟斌写的nginx_ajp_module模块,具体功能就是实现hmux协议...
PLDM入门(七):FRU Data Format
每个字段为TLV(Type-Length-Value)格式,具体类型、长度范围和值定义需参考。通过条件过滤(记录句柄、类型、字段类型等)分块获取FRU记录数据(可选功能)。整个FRU数据表由多个FRU记录数据块组成,每个数据块对应表2的结构(即包含。决定,每个字段按顺序排列(Type→Length→Value)通过分块传输方式写入FRU记录表数据(需终端支持写入操作)。(文档未提供表5内容,需结合标准文档完整版)。、字段数量、编码类型及具体字段的TLV数据)。无请求数据(空请求)。
三维重建之条纹投影结构光(三)——相位展开优化与多频外差实践
本文深入探讨了三维重建中条纹投影结构光技术的核心环节——相位展开优化。针对传统路径跟踪法存在的误差传播与路径依赖问题,重点解析了多频外差法的原理与优势,并通过详细的C++代码实践,展示了如何利用三频外差法实现鲁棒、高精度的相位展开,从而获得连续的绝对相位图,为后续三维点云生成奠定坚实基础。
What is hmux in resin?
When I start the Resin server it says hmux listening to localhost:6802 What is this hmux? Is this a service or just resin use it for itself? This is a sample of Resin output: Resin 3.0.2...
16、天文时间序列分类:基于人工神经网络的研究
本研究探讨了基于人工神经网络的天文时间序列分类方法,重点比较了MLP、LSTM和CNN等模型在BRITE和开普勒K2数据集上的表现。研究发现LSTM不适用于此类数据,而结合特征提取与PSO超参数优化的多层感知器(MLP)在开普勒K2数据上实现了98.55%的二分类准确率。通过精细的数据预处理和高置信度样本选择,显著提升了分类性能。研究成果为恒星变异性识别提供了高效工具,并对天文学与机器学习交叉领域具有重要参考价值。
java中ForeText_英语翻译500ServletExceptionjava.lang.NumberFormatException:Forinputstring:".20077E4.20077E...
英语翻译500 Servlet Exceptionjava.lang.NumberFormatException:For input string:".20077E4.20077E4"at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1224)at java.lang.Double.parseDouble(D...
YOLO11涨点优化:创新多尺度卷积注意力(MSCA)模块,小目标检测神器!
MSCA模块通过创新的多尺度设计,在保持计算效率的同时显著提升小目标检测能力。实验证明,在YOLOv5/v8等模型上嵌入MSCA后,mAP提升超过2%,小目标检测精度提升近4%,且计算代价增加极小。注意力机制的未来发展方向动态核尺寸:根据输入特征自适应调整卷积核大小跨模态融合:结合RGB与深度/热力图等多模态信息自监督优化:利用对比学习预训练注意力模块尝试在你的YOLO模型中插入MSCA模块,欢迎在评论区分享你的涨点结果!参考文献。
【JAVA】海康威视门禁机ISAPI接口开发,人脸上传更新接口
本文实现了一个HTTP工具类HTTPClientUtil,提供GET/POST/PUT/DELETE请求方法,支持摘要认证。工具类封装了Apache HttpClient,设置连接超时、最大连接数等参数,通过DeviceInfoDTO传递设备IP、端口和认证信息。文中还展示了两个应用示例:userInfoAdd()用于添加人员信息,FaceDataRecordAdd()用于添加人脸数据,均通过POST请求与设备ISAPI接口交互。该工具类简化了HTTP请求处理,支持设备管理系统的集成开发。
nginx hmux模块开源了
最初公司部门内是这样访问resin的 nginx-->resin 直接利用nginx的代理(http1.0)来访问resin,据运维人员实践结果,发现这样性能很差,于是中间加了apache这一层,于是变成这样。 nginx-->apache-->resin 这样就初步解决了上述问题。 后来听说杭州那边写了一个nginx访问tomcat ajp的
知识图谱设计简记
知识图谱是一种语义化的知识表示框架,通过实体-关系-属性三元组形式表达现实世界关联。其核心价值在于关联化整合数据、支持可解释性推理和赋能智能化应用。知识图谱可分为通用型和领域型两类,基本构成包括实体、关系、属性等基础元素,以及本体和实例等架构层元素。设计方法主要有自上而下、自下而上和混合式三种,需遵循业务导向、一致性等原则。在建模时需要明确属性与实体的判断标准,规范处理关系的方向性与对称性,并合理构建多重关系。主流技术框架如RDF和属性图体系均支持多重关系建模,选择需考虑业务需求。本体作为知识图谱的概念骨架
nginx hmux模块被冷落了
自从在开源中国上传了tcpcopy和nginx hmux模块介绍,tcpcopy反应不错,但nginx hmux连一个下载量都没有增加。 nginx hmux模块可是费了很大劲才写成的,要求苛刻,不能出大错。 tcpcopy一般出问题也没有关系,毕竟不影响到公司的赚钱。 所以还是写用户需要的,而且风险小的。
jdk-8u144-linux-x64.tar.gz.
该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
nginx通过hmux协议访问resin--测试项目列表
<br />项目列表如下: <br /><br /> 1)resin-doc <br /><br /> 2)jackrabbit <br /><br /> 3)hudson <br /><br /> 4)jetspeed <br /><br /> 5)geoserver <br /><br /> 6)VQWiki <br /><br /> 7)struts2-showcase <br /><br /> 8)spring-security-samples <br /><br
怀旧版电脑GBC模拟器
再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。
偶然发现nginx_hmux_module下载量增加了不少
居然还有老外用我们的东西,可惜我英文不好,不过居然还交流成功了,以后得加强英文交流的能力。
nginx 之 proxy_pass详解
在nginx中配置proxy_pass代理转发时,如果在proxy_pass后面的url加/,表示绝对根路径;如果没有/,表示相对路径,把匹配的路径部分也给代理走。 假设下面四种情况分别用 http://192.168.1.1/proxy/test.html 进行访问。 第一种: location /proxy/ { proxy_pass http://127.0.0.1/; }...
Tengine编译记录
以前一直使用apache进行服务器部署,从未考虑过什么,直到最近我发现了一个东西,nginx,这个东西引发了我的兴趣,容易的扩展和强大的性能吸引着我去一探究竟。 我选择了淘宝的开源项目Tengine 因为我比较信任能抗住双十一这种并发级别的能力。 废话不多说,上主菜。/×× ×环境CentOS7.0 64位 ×/首先下载必要的支持包tengine http://tengine.taobao.o
Nginx拷贝流量
借助Nginx httpLuaModule,将nginx上的流量拷贝一份到测试机,线上机的执行结果返回。测试机的执行结果并不返回。
小心点,不要瞎升级nginx
最近新增了功能,顺便把nginx升级到1.0.0,结果被nginx的bug恶性到了。 下面是利用tcpcopy,从access.log来分析nginx各种版本的测试结果: nginx-1.0.14 没有问题 [wangbin@bgp176-141 logs]$ grep '16/Mar/2012:11:37' acces
如何利用tcpcopy来试验nginx hmux模块(以下所涉及到的tcpcopy,均是采用的是0.5以下的版本)
场景是这样的: 公司原来是利用nginx-->apache-->resin(hmux 6800)来做的。 现在已经书写了nginx hmux模块,完全可以这样nginx--->resin(hmux 6800),把系统架构简化了。 那么是不是直接替换呢,这样做有很大的风险,万一上线全面崩溃,怎么办,公司损失不说,个人在公司的职业生涯也结束了。 怎么办,怎么办? 有人说,我们逐步逐步上线
开发nginx resin hmux协议的原因
<br />最初公司部门内是这样访问resin的 <br /><br /> nginx-->resin <br /><br /> 直接利用nginx的代理(http1.0)来访问resin,据运维人员实践结果,发现这样性能很差,于是中间加了apache这一层,于是变成这样。 <br /><br /> nginx-->apache-->resin <br /><br /> 这样就初步解决了上述问题。 <br /><br /> 后来听说杭州那边写了一个nginx访问t
resin 隐藏或修改Server
修改 resin.conf增加<server-header>节点 <cluster id="app-tier"> <!-- sets the content root for the cluster, relative to server.root --> <root-directory>.</root-direct...
lua编译问题总结
1、首先安装lua linux系统 make linux make install 2、编译 gcc -lm -g -o test test.c /usr/local/lib/liblua.a -ldl 如果少-ldl,那么编译就会报: gcc -lm -g -o test test.c /usr/local/lib/liblua.a /usr/
nginx多进程模式下保持后端连接keepalive为啥需要accept_mutex off的原因
先声明,如果可能分析有误,敬请见谅。我们从strace角度进行分析nginx访问memcached:nginx单进程模式下: [root@localhost sbin]# strace -p 13303 Process 13303 attached - interrupt to quit gettimeofday({1281607164, 794683}, NU
淘宝Tengine vs ngx_openresty
之前对这迷迷糊糊的,以为是同一个东西,问了agentzh,终于明白差别了。 agentzh是这样说的: Tengine 是一个 nginx 的 fork,而 ngx_openresty 是 nginx 的 bundle. 最初两者没有交集,后来Tengine 也是 ngx_openresty 多数核心组件的用户 了,Tengine pdf文档中提到ngx_lua等核心组件也不足为
ngx_http_upstream_keepalive_module原理分析
我们知道针对后端的keepalive是通过nginx.conf配置文件来指定的,例如 upstream resins{ server 61.135.250.217:6800; keepalive 1024; }nginx在读取配置文件的时候,就会执行指令相应的函数,查看ngx_http_upstream_keepalive_module源代码,我
544



被折叠的 条评论
为什么被折叠?



