简体   繁体   English

避免在Azure Service Fabric中进行序列化/反序列化?

[英]Avoiding Serialization/Deserialization In Azure Service Fabric?

I have an Actor service which has a method that looks something like this 我有一个Actor服务,它的方法看起来像这样

Task<IEnumerable<MyClass>> GetList();

I also have a web api as part of the ASF application that looks something like this 我还有一个Web API作为ASF应用程序的一部分,看起来像这样

[HttpGet("list")]
public async Task<IEnumerable<MyClass>> GetList()

This basically gets the list from the actor and then returns it. 这基本上是从actor获取列表,然后将其返回。 The performance isn't really good enough and I think this is down to the fact that the Actor service is serializing the list, sending it to the api which is deserializing it when it receives it before serializing it again to return it. 性能还不够好,我认为这是因为Actor服务正在序列化列表,将其发送到api,该api在接收到它时将对其进行反序列化,然后再次对其进行序列化以返回它。

Is there a better way? 有没有更好的办法? Can some of the serialization and deserialization be avoided? 可以避免某些序列化和反序列化吗?

Couple of questions: 1. Does your code in the webapi retrieve everything before returning? 几个问题:1.您的webapi中的代码是否在返回之前检索了所有内容? Can you post the gist of that code? 您可以张贴该代码的要点吗? 2. Have you considered streaming the results? 2.您是否考虑过流式传输结果?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM