Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have been told to make a process that insert data for clients using multithreading.
Need to update a client database in a short period of time.There is an application that does the job but it's single threaded.Need to make it multithread.
The idea being is to insert data in batches using the existing application
EG
Process 50000 records
assign 5000 record to each thread
The idea is to fire 10-20 threads and even multiple instance of the same application to do the job.
Any ideas,suggestions examples how to approach this.
It's .net 2.0 unfortunately.
Are there any good example how to do it that you have come across,EG ThreadPool etc.
Reading on multithreading in the meantime
I'll bet dollars to donuts the problem is that the existing code just uses an absurdly inefficient algorithm. Making it multi-threaded won't help unless you fix the algorithm too. And if you fix the algorithm, it likely will not need to be multi-threaded. This doesn't sound like the type of problem that typically benefits from multi-threading itself.
The only possible scenario I could see where this matters is if latency to the database is an issue. But if it's on the same LAN or in the same datacenter, that won't be an issue.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 months ago.
Improve this question
For one of my project, I need to create a task that updates the status of cars when they are late.
They are considered late when they exceed their schedule time.
So, I would like to know what is the best solution to do this.
Should I create a job that run every minute ? Or are there better solution that are less resources expensive ?
Considering the question, one of the solutions could be to use a scheduler like Quartz.net (https://www.quartz-scheduler.net/).
You did not present a lot of detail on the problem itself, so i am assuming that you are doing something like lending the car for someone and they have a time limit.
Since that information was not provided, there are a lot of scenarios. Do you really need a scheduler? Do you want to know if they are late when they are delivered/arrive? If so, you probably just need to calculate whenever the delivery/action you are expecting happens.
But, if you really need a scheduler to trigger something, you can use a scheduler.
Quartz.net can be in memory (good for POC purposes: https://www.quartz-scheduler.net/documentation/quartz-1.x/tutorial/job-stores.html#ramjobstore), but also in database (so you can share with multiple instances of the same service https://www.quartz-scheduler.net/documentation/quartz-1.x/tutorial/job-stores.html#ado-net-job-store-adojobstore).
You can simply have a job that has arguments (such as the car id), and then reuse the same code. The jobs can be scheduled in several ways, simply datetime (https://www.quartz-scheduler.net/documentation/quartz-3.x/tutorial/simpletriggers.html#simple-triggers), or even be recurrent with cron expressions (https://www.quartz-scheduler.net/documentation/quartz-3.x/tutorial/crontriggers.html#example-cron-expressions).
There are other schedulers available, but Quartz.Net was the one i already used in several scenarios, both professionally and personally
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I display some of the data i.e. Sum, Average and Total on a page and want to update them after the data changed using SignalR. Most of the examples uses the following approach that broadcast all of the clients after create / update / delete methods (that change data) are executed:
private void BroadcastDataChange(Data data)
{
Clients.All.dataChanged();
}
However, I am wondering if there is a smarter approach that let me update the data i.e. periodically refreshing without broadcast in each of the create-update-delete methods (I do not use SqlDependency, etc, juts using SignalR). On the other hand, I am not sure this kind of approach is contradictory to the SignalR logic. This is the first time I use SÄ°gnalR and I am too confused :( Any help would be appreciated.
You can use polling with SignalR. It's just an inefficient way of doing things though, because: (1) there would be a delay between when changes happen and when they are broadcast to clients. (2) broadcasts would happen even if data didn't change, which is a waste of resources.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a real time video processing application running on Windows 7/10 that has 4 distinct processing steps. Each of these steps is currently running in a WPF Task and I have eliminated copying of the video data as much as is possible, I am down to two copy operations. The capture of the video and the subsequent storing of the video is handled by a COM-based SDK. Would I see an increase in performance if I turned each of the steps into a separate exe and use a shared memory scheme to move the data between the exe's? Or rather than use WPF Tasks, use threads? Anyone have hard data on something like this?
Thanks,
Doug
Q: Will breaking a Windows 10 app into multiple exe's improve concurrency?
This question is very wide/broad, but as a generic answer: No
Parallel/concurrent performance is based on Windows scheduler which is based on threads and their priorities. It means that processes do not matter. You can have 10 processes with 1 thread each or 1 process with 10 threads. They all will be scheduled the same way. (Almost, with some exceptions which affect priorities, but not directly overall performance.)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I would like to build a c# spa application using angular with real-time messaging signal-r. The signal-r should read the data continuously from a data source and publish the updated data to the user and store the data in a database as well. It should also enable the chatting of the users.The expected number of users is around a hundred.
For such application what should be the best architectural structure of the solution? Should I implement two (three?) projects, e.g. one for the web app and the other for the signal-r, running as two applications? Then, in this case, how can I do the messaging between the applications? Or should I implement a single project for all of these? It would be best if you can provide the pros and cons of these alternatives or provide any other option.
Start with one project.
For 100 simultaneous users, you aren't even close to worried about load. Any simple hosting plan would take care of it easily. If you get more, ASP.NET and SignalR work just fine behind a load balancer (though certain operations can get more complicated).
A properly architected application won't be difficult to split into multiple processes in the future if it ever came to that, and doing so now is just adding mounds of complexity for no appreciable benefit. This goes double since it sounds like you are just starting out.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I want to write a C# application that compares the performance of two PCs, and know which PC will perform a task faster than the other.
So is there an algorithm for doing this?
for example ( (NumberOfProcessCurntlyRunning*AvailableRAM)+CPUUsage).
Assuming that we have 2 computers with the same computing and hardware power.
As I agree that there is no general purpose algorithm to determine the overall performance of a computer, there are some algorithms that are being used by scientists to create more reliable benchmarks for their papers. So if you implement another solution targeting the same problem you can tell if it's better then previously discovered ones even tho you are working on a different machine then previous teams.
One example can be a benchmark algorithm dfmax. It will give you in a short time some foggy idea on how fast the current machine is, but it won't take into account RAM that is available. But I think that it could be some start for you.
No, there isn't an algorithm to determine overall computer performance. There are lots of things that can affect overall performance.
You should determine what to compare; access to memory, the efficiency of the CPU cache, efficiency of GC, then implement functions for each of them.
If you need a blind test and you don't care any of specific metric then you can run the same function (e.g. quick sort) and log time and compare milliseconds.