sgi

2025-12-07 0 549

sgi插座网关接口

申请写在Erlang上。一般设计原理是:快速,低内存和模块化。

sgi提供了简单而智能的方式,可以通过TCP连接到任何服务器,并在TCP下使用其他协议。它支持两个协议:

  • fastcgi。该协议对于连接到PHP(FPM)是常见的。
  • UW sgi 。该协议是UW sgi服务器使用的本机协议。有关更多详细信息,请参见第三示例。

插座客户端

包括平衡器,是应用程序的重要组成部分。它可以连接到任意数量的服务器。它是灵活的,易于配置。如果服务器的关闭,则Balancer不会发送请求,并且有时会供应服务器的可用性。

平衡器可以随时开放新的连接,并以少量必要的连接开始。如果某些插座不会使用某个时间,则此插座将是封闭的释放内存。

平衡器有两种平衡方法:模糊优先级。请查看样品4,以了解每个4的优势。它将允许为不同的服务器体系结构配置套接字客户端。

代理人

应用程序可以通过代理创建连接,现在支持Socks5协议,您可以通过TOR发送消息。 @See配置部分。

基本组件

  • 服务器牛仔
  • 框架N2O

要求

  • Erlang 18.1+

文档

阅读Wiki中的文档。

升级

在安装新版本之前,请阅读升级。

尝试样本

示例1-从网站内的其他语言中添加内容。

该示例向您展示了如何使用PHP文件向网站添加“ Busines Logic”(大小)。

它基于N2O的样本。

sgi
$ cd sgi /samples
$ ./mad deps compile plan
$ ./mad repl\”>

 $ git clone git://github.com/astronin/ sgi
$ cd sgi /samples
$ ./mad deps compile plan
$ ./mad repl

以FCGI服务器运行PHP:

 $ sudo service php5-fpm start

现在您可以尝试一下:http:// localhost:8000

示例2-在Erlang Server和Websocket而不是AJAX之后,您的整个公共站点。

该示例向您展示了如何在WebSocket的支持下运行网站(用其他PL编写)。忘记Ajax,然后更快地完成您的页面。

即使在通用网页中,您也具有以下优点:

  • 快速地
  • 低矮的头顶,尤其是在HTTPS上
  • 轻松转发文件
  • 保存客户端和服务器的CPU资源
设置:

sgi
$ cd sgi /samples\”>

 $ git clone git://github.com/astronin/ sgi
$ cd sgi /samples

更改rebar.config中的应用程序:

 $ vim samples/apps/rebar.config

{sub_dirs,[“评论”]} 。 – > {sub_dirs,[“评论2”]}

在sys.config中更改应用程序:

{n2o,[{app,eview2}]}

运行FPM:

 $ sudo service php5-fpm start

运行服务器:

 $ ./mad deps compile plan
$ ./mad repl

URL:http:// localhost:8000/site.php

样品3-喜欢样品2,但使用python。

该示例向您展示了如何在WebSocket的支持下运行网站(在Python和支持UW sgi协议)中运行。为此,您需要使用服务器UW sgi 。

设置:

sgi
$ cd sgi /samples\”>

 $ git clone git://github.com/astronin/ sgi
$ cd sgi /samples

更改rebar.config中的应用程序:

 $ vim samples/apps/rebar.config

{sub_dirs,[“评论”]} 。 – > {sub_dirs,[“评论3”]}

在sys.config中更改应用程序:

sgi, [{servers, [
[{name, default}, {address, localhost}, {port, 3031}]
]}]}\”>

{ n2o , [{ app , review3 }]},
{ sgi , [{ servers , [
    [{ name , default }, { address , localhost }, { port , 3031 }]
]}]}

运行UW sgi :

sgi -file <your path clone> sgi /samples/cgi-scripts/python/myapp.py\”>

 $ uw sgi --socket 127.0.0.1:3031 --w sgi -file <your path clone> sgi /samples/cgi-scripts/python/myapp.py

运行服务器:

 $ ./mad deps compile plan
$ ./mad repl

URL:http:// localhost:8000/

样本4-插座连接的一部分

该示例向您展示了如何使用此应用程序的TCP客户端。多亏了Smart Balancer客户端,可以以不同的方法连接到任意数量的服务器: priorityblurred

设置:

sgi
$ cd sgi /samples\”>

 $ git clone git://github.com/astronin/ sgi
$ cd sgi /samples

更改rebar.config中的应用程序:

 $ vim samples/apps/rebar.config

{sub_dirs,[“评论”]} 。 – > {sub_dirs,[“评论4”]}

在sys.config中更改应用程序:

{n2o,[{app,评论4}]}

更改sys.config中的设置之后。样本将使用5个过程启动10台服务器。客户端将使用每个服务器上的5个插座连接。

{ servers , [
    [{ name , default }, { address , localhost }, { port , 10000 }, { timeout , 60000 }, { weight , 10 }, { start_connections , 4 }, { max_connections , 5 }, { max_fails , 5 }, { failed_timeout , 60 }],
    [{ name , aaa1 },    { address , localhost }, { port , 10001 }, { timeout , 60000 }, { weight , 9 },  { start_connections , 4 }, { max_connections , 5 }, { max_fails , 5 }, { failed_timeout , 60 }],
    [{ name , aaa2 },    { address , localhost }, { port , 10002 }, { timeout , 60000 }, { weight , 8 },  { start_connections , 4 }, { max_connections , 5 }, { max_fails , 5 }, { failed_timeout , 60 }],
    [{ name , aaa3 },    { address , localhost }, { port , 10003 }, { timeout , 60000 }, { weight , 7 },  { start_connections , 4 }, { max_connections , 5 }, { max_fails , 5 }, { failed_timeout , 60 }],
    [{ name , aaa4 },    { address , localhost }, { port , 10004 }, { timeout , 60000 }, { weight , 6 },  { start_connections , 4 }, { max_connections , 5 }, { max_fails , 5 }, { failed_timeout , 60 }],
    [{ name , aaa5 },    { address , localhost }, { port , 10005 }, { timeout , 60000 }, { weight , 5 },  { start_connections , 4 }, { max_connections , 5 }, { max_fails , 5 }, { failed_timeout , 60 }],
    [{ name , aaa6 },    { address , localhost }, { port , 10006 }, { timeout , 60000 }, { weight , 4 },  { start_connections , 4 }, { max_connections , 5 }, { max_fails , 5 }, { failed_timeout , 60 }],
    [{ name , aaa7 },    { address , localhost }, { port , 10007 }, { timeout , 60000 }, { weight , 3 },  { start_connections , 4 }, { max_connections , 5 }, { max_fails , 5 }, { failed_timeout , 60 }],
    [{ name , aaa8 },    { address , localhost }, { port , 10008 }, { timeout , 60000 }, { weight , 2 },  { start_connections , 4 }, { max_connections , 5 }, { max_fails , 5 }, { failed_timeout , 60 }],
    [{ name , aaa9 },    { address , localhost }, { port , 10009 }, { timeout , 60000 }, { weight , 1 },  { start_connections , 4 }, { max_connections , 5 }, { max_fails , 5 }, { failed_timeout , 60 }]
]},
{ balancing_method , priority }, % blurred or priority

运行服务器:

 $ ./mad deps compile plan
$ ./mad repl

更改sys.config next {balancing_method, blurred},

 $ ./mad repl

示例将创建两个文件: server_distribution(priority).csvserver_distribution(blurred).csv它显示了两种连接与服务器的连接方法之间的差异。在Excel(或其他)中打开文件,然后插入XY(Scater)图:

以下是下一个重量的结果:

服务器端口 重量
10000 1
10001 2
10002 3
10003 4
10004 10
10005 9
10006 8
10007 7
10008 6
10009 5

下载源码

通过命令行克隆项目:

git clone https://github.com/AstRonin/sgi.git

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

申明:本文由第三方发布,内容仅代表作者观点,与本网站无关。对本文以及其中全部或者部分内容的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。本网发布或转载文章出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,也不代表本网对其真实性负责。

左子网 开发教程 sgi https://www.zuozi.net/31875.html

sp dev fx extensions
上一篇: sp dev fx extensions
HL7
下一篇: HL7
常见问题
  • 1、自动:拍下后,点击(下载)链接即可下载;2、手动:拍下后,联系卖家发放即可或者联系官方找开发者发货。
查看详情
  • 1、源码默认交易周期:手动发货商品为1-3天,并且用户付款金额将会进入平台担保直到交易完成或者3-7天即可发放,如遇纠纷无限期延长收款金额直至纠纷解决或者退款!;
查看详情
  • 1、描述:源码描述(含标题)与实际源码不一致的(例:货不对板); 2、演示:有演示站时,与实际源码小于95%一致的(但描述中有”不保证完全一样、有变化的可能性”类似显著声明的除外); 3、发货:不发货可无理由退款; 4、安装:免费提供安装服务的源码但卖家不履行的; 5、收费:价格虚标,额外收取其他费用的(但描述中有显著声明或双方交易前有商定的除外); 6、其他:如质量方面的硬性常规问题BUG等。 注:经核实符合上述任一,均支持退款,但卖家予以积极解决问题则除外。
查看详情
  • 1、左子会对双方交易的过程及交易商品的快照进行永久存档,以确保交易的真实、有效、安全! 2、左子无法对如“永久包更新”、“永久技术支持”等类似交易之后的商家承诺做担保,请买家自行鉴别; 3、在源码同时有网站演示与图片演示,且站演与图演不一致时,默认按图演作为纠纷评判依据(特别声明或有商定除外); 4、在没有”无任何正当退款依据”的前提下,商品写有”一旦售出,概不支持退款”等类似的声明,视为无效声明; 5、在未拍下前,双方在QQ上所商定的交易内容,亦可成为纠纷评判依据(商定与描述冲突时,商定为准); 6、因聊天记录可作为纠纷评判依据,故双方联系时,只与对方在左子上所留的QQ、手机号沟通,以防对方不承认自我承诺。 7、虽然交易产生纠纷的几率很小,但一定要保留如聊天记录、手机短信等这样的重要信息,以防产生纠纷时便于左子介入快速处理。
查看详情

相关文章

猜你喜欢
发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务