服务器设计之SEDA架构

seda架构 NULL 博文链接:https://xylong.iteye.com/blog/1441956 立即下载

SEDA(Staged Event-Driven Architecture)的核心思想是把一个请求处理过程分成几个Stag,不同资源消耗的Stag使用不同数量的线程来处理,Stag间使用事件驱动的异步通信模式。

     更进一步,在每个Stage中可以动态配置自己的线程数,在超载时降级运行(如输出纯文字页面)或拒绝服务。

     在每个Stage的通常有如下组件:

Incoming Event Queue ,事件队列。 Admission Controller  阀门,拒绝服务。 Dynamically sized Thread Pool, 线程池。 Event Handler ,实际处理业务的Compinent。 Resource Controller ,控制Stage的参数。 2.Web2.0+SOA环境下的SEDA应用     Web2.0对架构师提出了新的挑战 ,  JavaEE 的同步调用机制(除JMS),有限的线程池与连接池(超出范围性能会下降),固定的定义在JNDI的资源对Web2.0/SOA的需求并不吻合。对BEEP,SCTP这些协议,必须依靠JCA另行编写模块来实现长连接模型。

    Java EE 迎合 Web 2.0(IBM DW) 提出,从统计学上看在系统总线程数固定的情况下,使用SEDA能获得较高的Throughput,阶段间的资源差异越大就越明显。     比如处理一个Web 2.0常用Mashup请求,有如下几步:

接收用户请求(1单位时间) 数据库查询(4单位时间) 根据数据库查询结果,准备Web Service调用参数(1单位时间) 发起Web Service调用((16单位时间)) 将结果渲染返回给用户(2单位时间)          那么SEDA会使用一条线程处理1.接收用户请求、3.准备WebService、5.返回结果,两条线程处理2.数据库查询, 而5条线程处理耗时最多的4.WebService请求。      结果表明,当远程调用所花时间不变,而本地操作得到优化时,系统通量也能获得明显提高。

3. Mule 中的SEDA 实例 Using SEDA to Ensure Service Availability(InfoQ)        Mule是SEDA架构的遵循者。每个Component间,用inbound->outBound的Queue异步相连,每个Component可以设置自己的线程池大小,队列长度。

      因此SEDA中的Stag间事件驱动异步链接,Stag内Incoming Event Queue,Thread Pool,Event Handler都有了。

<mule-descriptor name="RadioCarUMO" implementation="radioCar">    <threading-profile maxThreadsActive="5" maxThreadsIdle="10" poolExhaustedAction="WAIT" threadWaitTimeout="-1" id="component" doThreading="true"/>    <queue-profile maxOutstandingMessages="6"/>    <inbound-router>        <endpoint address="RadioCarsQueue"/>        <router className="org.mulefair.routing.BennyTheGatekeeper"/>    </inbound-router>    <outbound-router>        <router className="org.mule.routing.outbound.OutboundPassThroughRouter">             <endpoint address="FairAreaQueue"/>        </router>    </outbound-router></mule-descriptor>  

   而例子中的InboundRouter BennyTheGatekeeper,则实现了administration controller的角色,本来poolExhaustedAction="WAIT",而administration controller可以通过计数器,直接refuse需求,将请求转发到alarm queue。

   整个Stag中唯一缺失是动态改变资源参数的Resource Controller,threadpool也不是Dynamically sized Thread Pool,但这似乎不重要了。

    再一次觉得Mule充当Service Container比ESB时还要称职。

【OpenClaw企业级智能体实战】第11篇:制造业设备预测性维护实战——OpenClaw+DeepSeek+Prometheus从零搭建(附完整代码) 本文聚焦制造业设备预测性维护的核心痛点,基于OpenClaw v2026.2.1、DeepSeek智能诊断、Prometheus监控等工具,拆解“设备状态监控→智能故障诊断→预测性维护”三大核心场景。从技术原理、算法构建、实操流程到完整代码实现,提供“数据采集→模型训练→智能调度→自动处置”的全链路方案。方案遵循工业安全规范,采用“只读优先、权限最小化”原则,适配中小制造企业落地需求。通过虚拟案例验证,可使设备非计划停机时间下降65%、平均修复时间缩短47%,既适合新手快速入门,也为进阶读者提供架构优化思路 阅读详情

相关推荐

第二十三章 Nest集成日志框架Winston

Winston是一个非常流行的Node.js日志框架,而Nest.js是一个基于Node.js的后端框架。修改 winston.module.ts 内容如下 添加 forRoot 方法,接收 winston 的 createLogger 方法的参数,返回动态模块的 providers、exports。这里用到了 printf 的 format 函数,它可以自定义打印的日志格式 且使用了chalk 加上了颜色,并且打印了 dayjs 格式化的时间。可以看到控制台打印了自定义的 logger 的自定义。

枫ゞ的博客 1069

SEDA

SEDA(Staged Event-Driven Architecture)的核心思想是把一个请求处理过程分成几个Stag,不同资源消耗的Stag使用不同数量的线程来处理,Stag间使用事件驱动的异步通信模式。   更进一步,在每个Stage中可以动态配置自己的线程数,在超载时降级运行(如输出纯文字页面)或拒绝服务。   在每个Stage的通常有如下组件:   Incoming

arkblue的专栏 815

中职网络安全2021年国赛Wireshark流量分析题目解析

中职网络安全Wireshark流量分析题目解析

FRANXX_02的博客 6441

Staged Event-Driven Architecture

SEDA的是上演事件驱动架构的缩写,一个复杂的,事件驱动的应用程序分解成一组队列连接的阶段 。 这种设计避免了与基于线程的并发模型相关的开销,并分离事件和应用程序逻辑线程调度。 通过执行每个事件队列入场控制,服务以及空调加载,防止资源被过度,当需求超过服务能力。 SEDA的采用动态控制,自动调节运行参数(如每个阶段的调度参数),以及管理负载,例如执行自适应负载脱落。 分解成一阶段的服务,也使复杂...

weixin_33725270的博客 294

从Chimera到ChimeraX:科研绘图升级指南,让你的论文配图更专业

本文详细介绍了从UCSF Chimera升级到ChimeraX的科研绘图指南,帮助研究者提升论文配图质量。ChimeraX在渲染引擎、大分子处理能力和动画功能上具有显著优势,特别适合生命科学和结构生物学领域。文章涵盖材质设置、专业配色、工作流程和期刊适配等核心技巧,助力产出出版级分子可视化图像。

weixin_33670786的博客 928

解决linux 2.5G网卡驱动问题

解决linux 2.5G网卡驱动问题 关键词:2.5G网卡驱动,ubuntu,安装,2.5G Ethernet LINUX driver,Realtek网卡驱动 由于2.5G网卡较新,各linux发行版的通用驱动已不适用,新装的系统会出现无法上网问题,由于国内网络环境去Realtek官网很难下载到驱动文件,故本文提供github上的2.5G Ethernet LINUX driver r8125 for kernel up to 5.6的版本驱动文件r8125-9.003.05.tar.bz2各位可以自

poorguy_aos的博客 1万+

SEDA,一个不错的技术。

最近在看MULE的时候,发现了一个不错的技术--SEDA,不过现在我还不知道如何能独立出来应用到我的系统中呢。下面转载一篇文章,给大家看看。http://larryzhu.bokee.com/6779982.htmlStaged Event Driven Architecture (SEDA) 介绍关键词: SEDA    Staged    Event    Driven    Ar

jeff技术博客 3760

块坐标下降法实战:如何用Python一步步优化无人机通信网络?

本文通过Python实战案例,详细介绍了块坐标下降法在优化无人机通信网络中的应用。文章以最大化网络吞吐量为目标,将复杂的非凸问题拆解为功率分配和轨迹规划两个子问题,并提供了完整的算法实现、代码示例及调参指南,为机器学习工程师解决类似优化问题提供了实用参考。

sat99的博客 975

【服务器】SEDA

SEDA: An Architecture for Well-Conditioned, Scalable Internet Services Abstract ​ Staged Event-Driven Architecture(SEDA)是一种新的高并发Internet服务设计,旨在支持大量并发需求,并简化条件良好的服务的构造。在SEDA中,应用程序由显式队列连接的事件驱动阶段(event-driven stage)网络组成。 ​ SEDA利用一组动态资源控制器(dynamic resource co

Undefined ZONE 785

一文吃透 ABAP CDS SELECT:语法全景、关联与去重、可运行示例与实战心法

摘要: 本文深入解析ABAP中CDS视图的SELECT语法,重点介绍两种等价写法、关联与路径表达式优化、DISTINCT去重逻辑及WHERE/GROUP BY/HAVING/UNION等子句的应用。通过可运行的业务伙伴角色去重、关联路径查询及多角色筛选示例,演示如何将CDS特性转化为项目实践。强调关联复用性优于传统JOIN,并指出DISTINCT的权限边界与误用场景,帮助开发者从行式思维转向图式数据建模。(150字) 关键词: ABAP CDS、SELECT语法、路径表达式、DISTINCT去重、关联复用

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 391

基于Simulink的强化学习(DQN)自主调节占空比

摘要:本文介绍了一种基于Simulink的强化学习(DQN)方法,用于Buck变换器的自主占空比调节。通过建立马尔可夫决策过程模型,设计了包含状态、动作和奖励函数的强化学习框架,并在Simulink中实现了Buck主电路、RL接口模块和DQN智能体的集成。实验表明,相比传统PID控制,DQN方法在负载突变和输入跌落等复合扰动下表现出更好的鲁棒性,电压超调小于1%,恢复时间缩短至0.3ms。文章还详细讨论了关键设计技巧、工程挑战及对策,并提出了多目标优化、先进算法应用等扩展方向,为智能电源控制提供了新思路。

amy_mhd的博客 74

SEDA介绍与分析

<br />SEDA(Staged Event-Driven Architecture)并不是很新的技术,但它总会在我阅读的资料里出现些许影子,所以就拿出一些时间看了一下与它相关的论文资料。SEDA的目标很 远大,它要构建支持大并发的互联网系统,并克服多线程及事件驱动的服务器端模型的缺点。但SEDA来源于学术界,并且这个东西还是有些复杂了,所以至今工 业级的应用不是很多。它的官网是http://www.eecs.harvard.edu/~mdw/proj/seda/ ,上面的一些论文还是很不错的,

我的JAVA快乐生活 4193

Wi-Fi物理帧间隔概念简介

物理帧间隔概念简介。

1042484520@qq.com(邮箱) 1778

设计美好的服务器(6)--SEDA架构笔记

1.Overview SEDA  Adaptive Overload Control for Busy Internet Servers  An Architecture for Highly Concurrent,Well-Conditioned Internet Services       SEDA(Staged Event-Driven Arc

花钱的年华 7160

深度学习工具包 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');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

适于互联网的SEDA高并发架构

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33890499的博客 133

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

基于SEDA的异步框架设计与实现

基于SEDA的异步框架设计与实现 三、异步框架技术选型        在这次实现的SEDA异步框架中,采用的基础架构原型如下:         采用了spring+quartz+fastjson+rabbitmq来实现。和传统SEDA架构区别比较大的地方在于:         1、采用分布式mq(使用了rabbitmq)而不是blockingqueue。如此

IT小智博客 3008

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

SEDA简介与源码解读(一)

简介: -------------------------------------------------------------------------------------------------------------------------------------------------------------------- /* *分割线内...

weixin_34266504的博客 189
上一篇: Apache Mina 2.0.x 入门 (1)
下一篇: FREEBSD6.3 安装 TOMCAT6.0.14
dankes
博客等级 码龄22年 41粉丝 55原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值