我想最大的问题在于nginx的多进程和IO复用模型,虽然性能很好,但是由于不同用户只是通过协程进行隔离,协程是非抢占式的,一旦有某个用户脚本恶
意占用CPU,那么平台怎么能识别并限制他的资源呢?
另外_G变量是进程内全局共享的,也容易成为一个薄弱点。
请各位老师指教,:)
--
Best Regard!
- 俺听过几个 PaaS 的架构讲座,有以下几个方向:
- lua 脚本预判,对恶意代码,部署前识别并拒絶
- 虚拟机,不同应用是不同的 nginx 实例空间,限定资源,无全局数据可以跨应用访问
- nginx 自管,进行内存申用的次数限定,阻止恶意代码占用整体资源
> 请各位老师指教,:)
>
--
人生苦短, Pythonic! 冗余不做,日子甭过!备份不做,十恶不赦!
俺: http://about.me/zoom.quiet
文字协议: http://creativecommons.org/licenses/by-sa/2.5/cn/
--
邮件自: 列表“openresty”,专用于技术讨论!
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
详情: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
建议: 提问的智慧 http://wiki.woodpecker.org.cn/moin/AskForHelp
教程: http://agentzh.org/misc/nginx/agentzh-nginx-tutorials-zhcn.html
目前还有不少工作需要做 :)
> 我想最大的问题在于nginx的多进程和IO复用模型,虽然性能很好,但是由于不同用户只是通过协程进行隔离,协程是非抢占式的,一旦有某个用户脚本恶
> 意占用CPU,那么平台怎么能识别并限制他的资源呢?
>
ngx_lua 的抢占式协程支持一直是我们的一个 TODO :) 我们可以基于 Lua 语言的 Debug hook
来做。类似地,基于相同的技术可以实现计算资源的管配,强制中止 CPU 资源占用过多的协程。
具体到用户界面上,即会通过 lua_abort_after 和 lua_yield_after 这两条配置指令来控制。
> 另外_G变量是进程内全局共享的,也容易成为一个薄弱点。
>
_G 和 Lua module 都是整个 VM 共享的,因为涉及 lua registry,这一块的隔离确实需要做更多的工作 :)
Regards,
-agentzh
On May 23, 11:09 am, agentzh <agen...@gmail.com> wrote:
> 2012/5/22 Simon <bigp...@gmail.com>:
那样的话运行时开销会明显增大 :)
Regards,
-agentzh
Regards,
-agentzh
--
邮件自: 列表“openresty”,专用于技术讨论!
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
详情: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
建议: 提问的智慧 http://wiki.woodpecker.org.cn/moin/AskForHelp
教程: http://agentzh.org/misc/nginx/agentzh-nginx-tutorials-zhcn.html
- 楼开始歪了吼,,,俺推荐 OpenStack
- 其实,只是想作个純粹 OpenResty 的 PaaS 不应该复杂到哪儿的
- 因为全部内置了
- 只要解决对多个 Nginx 事例的統一监控,管理
--
On 5月24日, 下午8时15分, Anfernee Gui <anfernee....@gmail.com> wrote:
> No. Openstack是一个通用的IaaS,他屏蔽了底层虚拟化的实现,提供了统一的接口。
> Cloud Foundry是PaaS,可以建在OpenStack之上,当然CF是VMware的,所以目前用
> 了VMware的接口。不过开放的CF,将来可能会提供对更多平台的支持。
> 我不太了解OpenResty,不过我觉得PaaS的话一定要具备扩展能力,不然就不是云了嘛。。
>
>
>
>
>
>
>
>
>
> On Thu, May 24, 2012 at 8:02 PM, Zoom.Quiet <zoom.qu...@gmail.com> wrote:
> > 2012/5/24 Anfernee Gui <anfernee....@gmail.com>:
> > > PaaS还是比较复杂的。请大家关注Cloud Foundry,CF是完全open source的,可以自己搭一个玩玩。
>
> > - 楼开始歪了吼,,,俺推荐 OpenStack
> > - 其实,只是想作个純粹 OpenResty 的 PaaS 不应该复杂到哪儿的
> > - 因为全部内置了
> > - 只要解决对多个 Nginx 事例的統一监控,管理
>
> > > 做个广告:如果大家对CF在上海的职位有兴趣,可以发简历给我。
>
> > >http://cloudfoundry.com
> > >http://cloudfoundry.org
> > >http://github.com/cloudfoundry
>
> > > 2012/5/24 kindy <kind...@gmail.com>
>
> > >> 也许,
> > >> 可以考虑每 server 一个 VM,还是有可能的。
>
> > >> 不过,
> > >> 也许有强烈的需求才有意义。
>
> > >> 消耗还是较大的。
>
> > >> On Wed, May 23, 2012 at 6:39 PM, agentzh <agen...@gmail.com> wrote:
>
> > >>> 2012/5/23 Simon <bigp...@gmail.com>:
> > >>> > 如果是给每个请求一个VM,倒是能简单做到应用隔离,只要做好资源管理就可以了。
>
> > >>> 那样的话运行时开销会明显增大 :)
>
> > >>> Regards,
> > >>> -agentzh
>
> > >>> --
> > >>> 邮件自: 列表"openresty",专用于技术讨论!
> > >>> 发言: 请发邮件到 open...@googlegroups.com
> > >>> 退订: 请发邮件至 openresty+...@googlegroups.com
> > >>> 详情:http://groups.google.com/group/openresty
> > >>> 官网:http://openresty.org/
> > >>> 仓库:https://github.com/agentzh/ngx_openresty
> > >>> 建议: 提问的智慧http://wiki.woodpecker.org.cn/moin/AskForHelp
> > >>> 教程:http://agentzh.org/misc/nginx/agentzh-nginx-tutorials-zhcn.html
>
> > >> --
>
> > >> 林青(Kindy Lin)
>
> > >> --
> > >> 邮件自: 列表"openresty",专用于技术讨论!
> > >> 发言: 请发邮件到 open...@googlegroups.com
> > >> 退订: 请发邮件至 openresty+...@googlegroups.com
> > >> 详情:http://groups.google.com/group/openresty
> > >> 官网:http://openresty.org/
> > >> 仓库:https://github.com/agentzh/ngx_openresty
> > >> 建议: 提问的智慧http://wiki.woodpecker.org.cn/moin/AskForHelp
> > >> 教程:http://agentzh.org/misc/nginx/agentzh-nginx-tutorials-zhcn.html
>
> > > --
> > > Best Regards,
> > > Yongkun
>
> > > --
> > > 邮件自: 列表"openresty",专用于技术讨论!
> > > 发言: 请发邮件到 open...@googlegroups.com
> > > 退订: 请发邮件至 openresty+...@googlegroups.com
> > > 详情:http://groups.google.com/group/openresty
> > > 官网:http://openresty.org/
> > > 仓库:https://github.com/agentzh/ngx_openresty
> > > 建议: 提问的智慧http://wiki.woodpecker.org.cn/moin/AskForHelp
> > > 教程:http://agentzh.org/misc/nginx/agentzh-nginx-tutorials-zhcn.html
>
> > --
> > 人生苦短, Pythonic! 冗余不做,日子甭过!备份不做,十恶不赦!
> > 俺:http://about.me/zoom.quiet
> > 文字协议:http://creativecommons.org/licenses/by-sa/2.5/cn/
>
> > --
> > 邮件自: 列表"openresty",专用于技术讨论!
> > 发言: 请发邮件到 open...@googlegroups.com
> > 退订: 请发邮件至 openresty+...@googlegroups.com
> > 详情:http://groups.google.com/group/openresty
> > 官网:http://openresty.org/
> > 仓库:https://github.com/agentzh/ngx_openresty
> > 建议: 提问的智慧http://wiki.woodpecker.org.cn/moin/AskForHelp
资源控制确实可以在lua之前做,但如果进入lua之后,现在是没法再限制了。
On 5月24日, 下午9时35分, XinQi Yang <xinqiy...@gmail.com> wrote:
> 对访问控制进行一个细粒度的控制可以先暂时解决问题
> 不过对云不咋个了解,个人感觉如果就资源控制方面还是有很多地方可以做的,不需要到执行到lua里,就可以限制掉吧。
>
> 不过这个还是使用虚拟化技术会好多了,类似amazon的云,系统级别的隔离而不是应用级别的隔离。
>
> 在 2012年5月24日 下午8:26,Anfernee Gui <anfernee....@gmail.com>写道:
>
>
>
>
>
>
>
>
>
> > Weiqiang的想法和cloud foundry很相似。
>
> > 2012/5/23 Weiqiang <lweiqi...@gmail.com>
>
> >> 我倒是有个想法,就是采用类似Java版GAE的方法来做
> >> 应用独占一个openresty服务器。然后用lxc+cgroup这样的技术来实现应用服务器的隔离和QoS保证。
>
> >> 前端呢也用openresty来做应用路由(路由信息保存在shdict里,通过rest接口实现动态配置)
>
> >> 李伟强
>
> >> 2012/5/23 agentzh <agen...@gmail.com>
>
> >>> 2012/5/22 Simon <bigp...@gmail.com>:
> >>> > 在openresty基础上构建沙箱是否可行?
>
> >>> 目前还有不少工作需要做 :)
>
> >>> > 我想最大的问题在于nginx的多进程和IO复用模型,虽然性能很好,但是由于不同用户只是通过协程进行隔离,协程是非抢占式的,一旦有某个用户脚本恶
> >>> > 意占用CPU,那么平台怎么能识别并限制他的资源呢?
>
> >>> ngx_lua 的抢占式协程支持一直是我们的一个 TODO :) 我们可以基于 Lua 语言的 Debug hook
> >>> 来做。类似地,基于相同的技术可以实现计算资源的管配,强制中止 CPU 资源占用过多的协程。
>
> >>> 具体到用户界面上,即会通过 lua_abort_after 和 lua_yield_after 这两条配置指令来控制。
>
> >>> > 另外_G变量是进程内全局共享的,也容易成为一个薄弱点。
>
> >>> _G 和 Lua module 都是整个 VM 共享的,因为涉及 lua registry,这一块的隔离确实需要做更多的工作 :)
>
> >>> Regards,
> >>> -agentzh
>
> >>> --
> >>> 邮件自: 列表"openresty",专用于技术讨论!
> >>> 发言: 请发邮件到 open...@googlegroups.com
> >>> 退订: 请发邮件至 openresty+...@googlegroups.com
> >>> 详情:http://groups.google.com/group/openresty
> >>> 官网:http://openresty.org/
> >>> 仓库:https://github.com/agentzh/ngx_openresty
> >>> 建议: 提问的智慧http://wiki.woodpecker.org.cn/moin/AskForHelp
> >>> 教程:http://agentzh.org/misc/nginx/agentzh-nginx-tutorials-zhcn.html
>
> >> --
> >> 邮件自: 列表"openresty",专用于技术讨论!
> >> 发言: 请发邮件到 open...@googlegroups.com
> >> 退订: 请发邮件至 openresty+...@googlegroups.com
> >> 详情:http://groups.google.com/group/openresty
> >> 官网:http://openresty.org/
> >> 仓库:https://github.com/agentzh/ngx_openresty
> >> 建议: 提问的智慧http://wiki.woodpecker.org.cn/moin/AskForHelp
> >> 教程:http://agentzh.org/misc/nginx/agentzh-nginx-tutorials-zhcn.html
>
> > --
> > Best Regards,
> > Yongkun
>
> > --
> > 邮件自: 列表"openresty",专用于技术讨论!
> > 发言: 请发邮件到 open...@googlegroups.com
> > 退订: 请发邮件至 openresty+...@googlegroups.com
> > 详情:http://groups.google.com/group/openresty
> > 官网:http://openresty.org/
> > 仓库:https://github.com/agentzh/ngx_openresty
> > 建议: 提问的智慧http://wiki.woodpecker.org.cn/moin/AskForHelp
新浪的SAE,我的理解是通过apache prefork来实现的,每个请求之间通过进程隔离,实现简单很多,但是对系统资源利用不高。
我觉的VM的消耗要比进程小多了。
On 5月24日, 下午5时38分, kindy <kind...@gmail.com> wrote:
> 也许,
> 可以考虑每 server 一个 VM,还是有可能的。
>
> 不过,
> 也许有强烈的需求才有意义。
>
> 消耗还是较大的。
>
>
>
>
>
>
>
>
>
> On Wed, May 23, 2012 at 6:39 PM, agentzh <agen...@gmail.com> wrote:
> > 2012/5/23 Simon <bigp...@gmail.com>:
> > > 如果是给每个请求一个VM,倒是能简单做到应用隔离,只要做好资源管理就可以了。
>
> > 那样的话运行时开销会明显增大 :)
>
> > Regards,
> > -agentzh
>
> > --
> > 邮件自: 列表“openresty”,专用于技术讨论!
> > 发言: 请发邮件到 open...@googlegroups.com
> > 退订: 请发邮件至 openresty+...@googlegroups.com
> > 详情:http://groups.google.com/group/openresty
> > 官网:http://openresty.org/
> > 仓库:https://github.com/agentzh/ngx_openresty
> > 建议: 提问的智慧http://wiki.woodpecker.org.cn/moin/AskForHelp
On 5月25日, 下午2时57分, Anfernee Gui <anfernee....@gmail.com> wrote:
> 如果你说的VM指的是虚拟机,那我可以告诉你,一定是不可能的。建VM的代价很大,但建app是个非常轻量级的动作。
> 我不理解为什么VM的消耗会比进程小。新浪的SAE和CF有一些合作,他们的ruby实现就是CF。中间的那段我也没看懂。
>
> anfernee
>
> 2012/5/25 Simon <bigp...@gmail.com>
我一直打算实现一个 Nginx 虚拟主机一个 Lua VM. (或者说一个 server 配置块对应一个 Lua VM)。
> 不过,
> 也许有强烈的需求才有意义。
>
主要是一般配置 Web 应用的粒度是虚拟主机,而非 Nginx 服务器实例,实现各个不同的 Web 应用在同一个 Nginx 服务器中的隔离还是有意义的。
> 消耗还是较大的。
>
相比每请求一个 Lua VM,消耗小太多了,呵呵。
Regards,
-agentzh
On May 25, 11:18 pm, agentzh <agen...@gmail.com> wrote:
> 2012/5/24 kindy <kind...@gmail.com>:
On May 25, 11:18 am, agentzh <agen...@gmail.com> wrote:
> 2012/5/24 kindy <kind...@gmail.com>:
>
Regards,
-agentzh
--
邮件自: 列表“openresty”,专用于技术讨论!
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
详情: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
建议: 提问的智慧 http://wiki.woodpecker.org.cn/moin/AskForHelp
教程: http://agentzh.org/misc/nginx/agentzh-nginx-tutorials-zhcn.html
在openresty基础上构建沙箱是否可行?
我想最大的问题在于nginx的多进程和IO复用模型,虽然性能很好,但是由于不同用户只是通过协程进行隔离,协程是非抢占式的,一旦有某个用户脚本恶
意占用CPU,那么平台怎么能识别并限制他的资源呢?
另外_G变量是进程内全局共享的,也容易成为一个薄弱点。
请各位老师指教,:)
--
Best Regard!
--
邮件自: 列表“openresty”,专用于技术讨论!
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
详情: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
建议: 提问的智慧 http://wiki.woodpecker.org.cn/moin/AskForHelp
教程: http://agentzh.org/misc/nginx/agentzh-nginx-tutorials-zhcn.html