C# Threads How to optimize a SELECT with BLOB

Asked

Viewed 119 times

2

I have an application in C# (.Net 4.5) that when loading a screen among other operations it looks for a background image and sounds in the database. It happens that for some screens loaded this operation (search images + sounds) takes 29 seconds, which causes a bad user experience. I’d like to create something to make that time fall. I implemented 2 Threads one for each operation, but the running time jumped to 31 seconds. Someone has a solution to improve it?

    Task t1 = new Task(CarregarImagens);
    t1.Start();

    Task t2 = new Task(CarregarSons);
    t2.Start();

1 answer

2

Threading, by itself, it does not make the process faster; practice allows you to parallelize your processing, which can be a great benefit if your processes go into Waitstate frequently.

A solution would be to obtain the images and sounds at an earlier point of the process, in the style of pre-fetching. Thus, the features would be available immediately when the user requests them.

  • I get it. This system is a system developed to run didactic courses, before the student log in and select the class that will attend there is no way I load the screens.

  • @Leandrosjrp, I imagine - this is more a question of the current implementation than of threading. You can try to optimize time in several ways: compressing resources, reducing resolution/bitrates, etc.

  • Before leaving for any solution I raised it together with the team. However, they discarded this idea saying that the bank of courses is immense and to replace the courses would be impractical. Well... Patience right!? But thanks for the tips.

  • Unfortunately you are limited by choices, @Leandrosjrp . = / It might be worth raising the possibility of targeting your mysql database. Anyway, good luck to you!

  • Thank you! Thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.