简体   繁体   中英

How to increase IIS pool performance?

I have method which looks like this:

     [HttpPost]
     public async Task<ActionResult> ConvertWav(int id)
     {
       using (var c = new DbEntities())
           {
              var converter = new FFMpegConverter();
              //code which converting some files from the path which the take from the DB 
              //and put it in the local directory
           }
     }

It's simple ASP.NET web application, which converting files by id from the table in DB. The table also has "dest_path" and "input_path" fields. Table contains just a path to local files. For example D:/example/file.mp3

But when it start converting, % of CPU time which converter using is very tiny. Less that 0,1% of all capability. When I starting a few converter operations (sending a few requests), it becomes even less. 在此处输入图片说明

I tried using Web Garden but had the same result. How can I increase CPU usage for my requests? Full code: https://codeshare.io/7XMec

Psychic Debuging ACTIVATE!

Without seeing the rest of the code, it is very likely that your issue is that you are using the Buffered I/O API with SQL Server. This means that the time to first byte on the FFMpeg process is the time to last byte on the EntityFramework process. The solution?

You need to replace all the EF and access your database via the SqlFileStream class. Then you need to pipe the data into your FFMPeg process as opposed to using files/byte arrays.

It looks like you need to use the FFMpegConverter.ConvertLiveMedia method instead of the FFMpegConverter.ConvertMedia method to achieve this. Overall you will still find that you will be probably I/O bound rather than CPU bound.

However, in future, you should get yourself a profiler to debug perf issues.

Your interpretation of the symptom is completely wrong.

By using such an async action and launch the converter, it is by design to see w3wp.exe consumes almost no CPU resources, as it simply waits for that converter task to finish.

Meanwhile, it is a poor design to do long running tasks in ASP.NET as that framework was designed for simple and quick tasks with moderate timeouts. Frameworks such as SignalR can be a better option.

Web Garden will help you but won't help much under high load, as if all threads wait on the converters, the site performance will still be poor as it cannot easily spin a free thread then.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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