Closed DmitriiGaidukov closed 3 years ago
I think it's a limitation in the native library, that it doesn't support multiple concurrent calls. But I may be wrong, this "feature" was in the original code before I forked it.
@DmitriiGaidukov what error message are you getting?
@ognjenkurtic no an error as such, I just noticed when multiple web requests perform conversion simultaneously, they do it one at a time, e.g. if a few web requests started doing the conversion at the same moment and for the first one it took 100 ms, then it would be 200 ms for the second, 300 ms for the third, etc. And an increase in the number of simultaneous conversions doesn't increase the load on the CPU.
I'm pretty sure the native library is single-threaded so that's why it will serialize the requests. I'm not aware of any way to work around that.
In my ASP.NET Core app, I run into a problem with the Synchronized converter that multiple web requests are queued on a single thread instead of running in parallel and/or utilizing all cores. I take it it is the expected behavior:
Use this converter in multi threaded applications and web servers. Conversion tasks are saved to blocking collection and executed on a single thread.
Is there a way to work around this limitation? For ASP.NET Core apps it's a really big issue as they are inherently multithreaded.