是否可以使用WCF架构每天处理1B请求?

时间:2022-02-16 15:50:26

I have machine learning WCF service written in .NET. Not very compute intensive, but there are some minor computations. There are 2 big shared collection:

我有机器学习用.NET编写的WCF服务。计算量不是很大,但有一些小的计算。有2个大共享集合:

  • ConcurrentDictinary with stats and results
  • ConcurrentDictinary有统计数据和结果
  • MemoryChache inside locks with user session details.
  • MemoryChache内部锁定用户会话详细信息。

It working very fast and gives several milliseconds response(on client side) time inside LAN with not very intensive workload. As work load will be higher - ConcurrentDictinary, lock`s, MemoryChache(with GC) and WCF infrastructure(with WebServer) will be the limiting factors.

它运行速度非常快,并且在LAN内部提供几毫秒的响应(在客户端),工作量不是很大。随着工作量的增加 - ConcurrentDictinary,lock`s,MemoryChache(带GC)和WCF基础设施(带WebServer)将成为限制因素。

Now I have a customer with HUGE traffic, so I am expecting up to billion (up to 200m per day user-session * 5 request from one user) requests per day. And requests are synchronous(page load time will dependens on them) so I must to minimise response time.

现在我有一个拥有巨大流量的客户,所以我预计每天会有高达十亿(每天高达200米的用户会话* 5个来自一个用户的请求)请求。请求是同步的(页面加载时间将取决于它们)所以我必须尽量减少响应时间。

So:

所以:

Can I make WCF infrastructure scale horizontally? Can WCF requests be parallelized to several endpoints in equal proportions?

我可以横向扩展WCF基础架构吗? WCF请求可以以相同的比例并行化到多个端点吗?

To parallelize memory usage by MemoryChache and general computations I think can use some custom kind of MapReduce. Is there any build in distributed computation approach for .NET that can help me? AFAIK - no. Maybe it is easier to rewrite evething in SCALA and use Hadoop or, better, Spark. But don't want to rewrite evething :( Ideas?

要通过MemoryChache和一般计算来并行化内存使用,我认为可以使用一些自定义类型的MapReduce。 .NET的分布式计算方法是否有任何构建可以帮助我? AFAIK - 没有。也许更容易在SCALA中重写evething并使用Hadoop或更好的Spark。但是不想重写evething :(想法?

1 个解决方案

#1


3  

Yes, look in to load balancing for horizontal scaling. You can do this through a hardware solution with a traffic manager (F5 is popular provider - click this link for more info), through a software balancer (e.g. Consul) or through your code - there is a good sample on Code Project.

是的,请查看负载均衡以进行水平缩放。您可以通过带有流量管理器的硬件解决方案(F5是受欢迎的提供商 - 点击此链接获取更多信息),通过软件平衡器(例如Consul)或通过您的代码完成此操作 - Code Project上有一个很好的示例。

Strategies for load balancing include round robin, or a resource based decision on which service is least busy.

负载平衡策略包括循环,或基于资源的决定,哪个服务最不忙。

With 1B transactions, the network may become the bottleneck which will force you to a hardware solution. For a crude solution with little routing intelligence you could host your service on 100 or 1000 machines on separate endpoints and then have your customer proportion the traffic to the nodes.

对于1B事务,网络可能成为迫使您使用硬件解决方案的瓶颈。对于路由智能很少的原始解决方案,您可以在单独的端点上的100或1000台计算机上托管您的服务,然后让您的客户按比例分配节点的流量。

I think the most telling piece of information is if there is any shared state - do instances need to be aware of each other. If so, then you have more than simple load balancing to think about!

我认为最有说服力的信息是,如果有任何共享状态 - 实例需要彼此了解。如果是这样,那么您需要考虑的不仅仅是简单的负载平衡!

#1


3  

Yes, look in to load balancing for horizontal scaling. You can do this through a hardware solution with a traffic manager (F5 is popular provider - click this link for more info), through a software balancer (e.g. Consul) or through your code - there is a good sample on Code Project.

是的,请查看负载均衡以进行水平缩放。您可以通过带有流量管理器的硬件解决方案(F5是受欢迎的提供商 - 点击此链接获取更多信息),通过软件平衡器(例如Consul)或通过您的代码完成此操作 - Code Project上有一个很好的示例。

Strategies for load balancing include round robin, or a resource based decision on which service is least busy.

负载平衡策略包括循环,或基于资源的决定,哪个服务最不忙。

With 1B transactions, the network may become the bottleneck which will force you to a hardware solution. For a crude solution with little routing intelligence you could host your service on 100 or 1000 machines on separate endpoints and then have your customer proportion the traffic to the nodes.

对于1B事务,网络可能成为迫使您使用硬件解决方案的瓶颈。对于路由智能很少的原始解决方案,您可以在单独的端点上的100或1000台计算机上托管您的服务,然后让您的客户按比例分配节点的流量。

I think the most telling piece of information is if there is any shared state - do instances need to be aware of each other. If so, then you have more than simple load balancing to think about!

我认为最有说服力的信息是,如果有任何共享状态 - 实例需要彼此了解。如果是这样,那么您需要考虑的不仅仅是简单的负载平衡!