Closed shiyong-1224 closed 4 months ago
@shiyong-1224 Sorry, but I cannot reproduce this issue. When I generate PDFs in parallel threads, they work fast. More threads -> faster generation. Can you create a sample project for reproducing the problem?
@asolntsev Thanks for your Reply,here is a sample project https://github.com/shiyong-1224/test-pdf.git
@shiyong-1224 Thank you for sharing the project, but ... again, how I could easily reproduce the problem? What script should I run? I assume (from README) that you use JMeter, but you haven't committed any JMeter scripts.
Is it possible that the problem is caused by Spring/Tomcat/servlets/etc... ?
Anyway, I've found few candidates for performance improvement in FlyingSaucer. I will release these improvements soon, but not sure it entirely fixes your problem.
@asolntsev Sorry I didn't describe it clearly. That is how to reproduce the problem:
I changed corePoolSize from 2 to 8 to 16, and use Jmeter(uploaded a script) to make full use of threads, Then I saw the time consumed increasing by num of threads. I found these 2 methods layout() & createPDF consumed more time. I've read some source codes of these 2 methods, have no idea about the appearance. As for Spring/Tomcat/servlets or any other frameworks, I don't known how they affect the performance of layout() & createPDF Anyway, in my real production environment, I can increase the tps by adding more instances of the pdf service cluster.
@shiyong-1224 Hi. Can you check if the problem was fixed in FlyingSaucer 9.9.0?
I am using a ThreadPoolExecutor to execute a pdf rendering task (flying-saucer-pdf:9.1.22 Java 11), here is the main code of each task:
It performs best when I set corePoolSize = 2 As I increase the corePoolSize, the time consuming of 'layout' and 'createPDF' method increases and the tps decreases. Even if I increased the CPU from 2 cores to 8 cores, it didn't help. so I wonder if there is any resource contention or lock between threads, and how can I improve the tps of single machine