C#和CPython的之间的快速,可扩展的RPC [英] Fast and scalable RPC between C# and CPython

查看:392
本文介绍了C#和CPython的之间的快速,可扩展的RPC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在C#中的一些反馈 - 科学应用CPython的整合。

I need some feedback on C# - cPython integration for scientific application.

场景如下:C#进行数据采集和可视化 - 数据处理使用CPython的几个和不断变化的第三部分库来实现特定领域的任务

The scenario is the following: C# for data acquisition and visualization - CPython for data manipulation using several and changing third part library to implement domain specific tasks.

一般用例:


  1. C#代码获取实时数据从设备

  2. C#代码将数据传递到CPython的代码,并要求制定

  3. CPython的代码执行魔术

  4. CPython的代码通过结果返回到C#代码

  5. C#在WPF应用程序

  1. C# code get realtime data from device
  2. C# code pass data to cPython code and ask for elaboration
  3. Cpython code does the magic
  4. Cpython code pass result back to c# code
  5. C# visualizes data in a WPF application

C#和CPython的代码(第1项)可视化数据,3)和5))已被优化速度。
的数据在两个方向上(第2项)和4))基本上是10E6双
(不涉及复杂的数据结构)的阵列被传递。

Both c# and cPython code (item 1),3) and 5)) have already been optimized for speed. Data to be passed in both direction (item 2) and 4)) are essentially arrays of 10E6 double (no complex data structure involved).

我想找到性能良好的接口解决方案(速度将会从1到5)
和去耦能力,谁也最大限度地减少了客户端的开发(C#代码)
面。
实际上在同一台机器上两侧跑,但我想解决向外扩展

I'd like to find an interfacing solution with good performance (speed in going from 1 to 5) and decoupling capabilities who also minimizes the development on client (c# code) side. Actually both side run on the same machine, but I'd like the solution to scale out.

解决方案我已经试过 - 问题:

Solutions I've tried - issues:


  • 一)C#+对.NET移植蟒蛇算法 - 太多的代码编写/域侧改写
    ,缺乏专业图书馆的CPython的为在科学性的一面几乎所有

  • b)C#嵌入IronPython的+上托管代码包装/移植C ++的扩展名(有和没有的铁定) - 所造成的算法执行过程中采用的结构的封送处理边界性能。

  • )C#嵌入IronPython的+ RPC IronPython和巨蟒之间 - 在可维护性的问题,
    不会因以通满足了三C#/ IronPython的/蟒蛇之间的数据<。 / LI>
  • D)XML-RPC,JSON-RPC - 不是性能(速度满足)

  • a) C# + porting python algorithm on .NET - too many code to write/rewrite on domain side, lack of specialized library cPython provide for almost everything on scientific side
  • b) C# embedding ironpython + wrapping/porting c++ extension on managed code (with and without ironclad) - borderline performance caused by the marshaling of structures used during algorithms execution - dll hell when upgrading version of subcomponents.
  • c) C# embedding ironpython + rpc between ironpython and python - issues in maintainability, not satisfied by having to "pass" data between the three C#/ironpython/python .
  • d) XML-RPC, JSON-RPC - not satisfied by performance (speed).

尚未尝试的解决方案,我计划评估:

Solutions not already tried which I plan to evaluate:

  • e) Apache Thrift
  • f) ZeroRPC

先谢谢您的任何批评,意见和建议

Thanks in advance for any criticism, comments and suggestions.

推荐答案

我有一个类似的要求(C#< - >的Python RPC)我只是在尝试使用Apache节俭,我已经非常深刻的印象。它的速度非常快:比Pyro4 /咸菜慢50%,5比RPyC快。这是为周围发送numpy的数组作为二进制数据。用节俭剩余开销是有可能的阵列数据到/从串的复制。如果储蓄可重构采取到位的字符串缓冲区对象,我希望它的速度像火焰兵。

I have a similar requirement (C#<->Python RPC) I've just been experimenting with Apache Thrift and I've very impressed. It's very fast: 50% slower than Pyro4/pickle, 5x faster than RPyC. This is for sending numpy arrays around as binary data. The remaining overhead with Thrift is likely the copying of the array data into/out of strings. If Thrift could be refactored to take buffer objects in place of strings, I would expect it to be as fast as Pyro.

代码生成看起来很干净,API是很好的。它缺乏的主要是文档。不过,我已经能够从基本教程,测试和浏览源把事情做好。

The code-generation seems very clean and the API is nice. The main thing it lacks is documentation. Still, I've been able to figure everything out from the basic tutorial, tests and browsing the source.

据我可以看到ZeroRPC不(还)有一个C#实现。

As far as I can see ZeroRPC doesn't (yet) have a C# implementation.

这篇关于C#和CPython的之间的快速,可扩展的RPC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆