充电过程中的多线程 [英] Multi threading in Recharge Process

查看:84
本文介绍了充电过程中的多线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Experts,



我的数据库中有100000 ++个客户记录。其中有一些客户余额少于200美元,那么我们希望快速为这些客户充电平衡。如果我通过使用正常的foreach循环来处理这个过程,则需要时间。



所以我想通过使用多线程来工作。



我需要知道一些问题

我怎样才能通过500个客户ID为线程。

如何检查设置应用程序中的线程数。

如何检查应用程序加载状态(内存和CPU使用情况)以获得最佳效果申请表现。









谢谢

Hello Experts,

I have 100000++ Customer records in my database. In which have some customer balance is less then 200$ then we want to recharge those customers balance quickly.If i am working that process by using normal foreach loop then it is taking time .

So i want to work it by using multi threading.

I need to know some questions
How can i pass the 500 customers id to thread.
How can i check the set the number of thread in application.
How can i check Application Load states (Memory and Cpu Usage) for best performance of Application.




Thanks

推荐答案

然后我们想要快速为那些客户充电。如果我使用正常的foreach循环来处理这个过程,那就需要时间。



所以我想通过使用多线程来工作。



我需要知道一些问题

我怎样才能通过500个客户id to thread。

如何检查设置应用程序中的线程数。

如何检查应用程序加载状态(内存和CPU使用情况)以获得最佳应用程序性能。









谢谢
then we want to recharge those customers balance quickly.If i am working that process by using normal foreach loop then it is taking time .

So i want to work it by using multi threading.

I need to know some questions
How can i pass the 500 customers id to thread.
How can i check the set the number of thread in application.
How can i check Application Load states (Memory and Cpu Usage) for best performance of Application.




Thanks


两种方法我建议你这样做......



1.编写SQL查询以根据需要获取数据,

SELECT * FROM Customer WHERE Balance < 200



2.对于.Net Framework 4.5您还可以考虑使用并行循环,

为此通过本文

并行编程比以前更容易使用.NET Framework 4 [ ^ ]
Two Methods I suggest you to do...

1. Write SQL Query to Get Data as you need,
SELECT * FROM Customer WHERE Balance < 200

2. For .Net Framework 4.5 You can also consider Using Parallel Loops,
For That go through this article
Parallel Programming Easier than ever using .NET Framework 4[^]


我不明白你是否通过数据库中的每一行,

如果是这样,为什么不选择全部WHERE balance< 200的记录?



和Jibesh建议如果你需要更新,也可以在一个动作中完成。

如果您需要线程帮助以便在结果的每一行上执行



您可以查看Sacha'的文章:

.NET中线程初学者指南:n的第1部分 [ ^ ]
I didn''t understand if you do through each line in the DB,
if so, why not select all records that have "WHERE balance < 200"?

and as Jibesh suggested if you need update, that can also be done in one action.
if you need help with threads in order to perform an action on each row of the result

you can check out Sacha''s article:
Beginners Guide to Threading in .NET: Part 1 of n[^]


这篇关于充电过程中的多线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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