如何将大量本机代码转变为可扩展的服务?
问候, 我在 Eiffel 开发了一个大型软件。可以使用 C++ 中的此代码,但它会加载 Eiffel 运行时,并且我不能相信 Eiffel 代码和运行时是线程安全的,当从 C++ 的多个线程访问时,
我需要将此本机代码转换为服务,但我想在高负载的情况下扩展到多个服务器。我不想将缩放方面委托给 Eiffel 代码 &运行时,因此我正在考虑使用现有的可扩展性选项来包装此代码。
Apache Web 服务器下是否有任何东西可以让我提供对这段代码的线程安全访问?埃菲尔代码实例池怎么样?我的想法是这样的:
[网络上有很多客户端请求] ---> [一些可扩展的框架] --> [创建 Eiffel 代码的一个或多个实例]
我希望框架能够让我包装昂贵的代码块的多个实例,并且我想通过添加更多机器来像网络场一样扩展它。
最好的问候
瑟里夫
Greetings,
I have a large piece of software developed in Eiffel. It is possible to use this code from C++, but it loads Eiffel runtime, and I can't trust the Eiffel code and runtime to be thread safe, when accessed by multiple threads from C++
I need to turn this native code into a service, but I would like to scale to multiple servers in case of high load. I don't want to delegate the scaling aspect to Eiffel code & runtime, so I'm looking into wrapping this code with existing scalability options.
Is there anything under Apache web server that'd let me provide thread safe access to this chunk of code? How about a pool of Eiffel code instances? What I have in mind is something like this:
[lots of client requests over network] ---> [Some scalable framework] --> [One or more instances of expensive to create Eiffel code]
I'd like the framework to let me wrap multiple instances of expensive chunks of code and I'd like to scale this up just like a web farm, by adding more machines.
Best Regards
Seref
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您没有依赖 Apache,但任何其他框架就足够了,我建议您查看 ZeroMQ 消息传递框架。其
ZMQ_PUSH
/ZMQ_PULL
模型使用zmq_tcp
传输似乎可以满足您的要求。您的设置类似于:一个为外部请求提供服务的“主”进程(使用任何语言/平台,可能是 Apache mod),以及运行时可配置数量的 C++ 工作进程,这些进程调用 Eiffel 代码并将结果推送回来。
If you're not tied to Apache but any other framework would suffice, I suggest you check out the ZeroMQ message passing framework. Its
ZMQ_PUSH
/ZMQ_PULL
model withzmq_tcp
transport seems to do what you want.Your setup would be something like: one "master" process servicing outside requests (in any language/platform, perhaps an Apache mod) and a runtime-configurable number of C++ worker processes that call into Eiffel code and push results back.