Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
472 Tampilan

I am facing performance issues when trying to print custom accounting reports to Excel. These reports cover a significant amount of data, typically spanning 6 months. Despite having the server running on 2 workers in Odoo.sh, the server occasionally crashes during this process.

I am unsure if I should focus on optimizing the code to handle the export process more efficiently or if there is a better approach for viewing and handling these accounting reports.

Could anyone share insights or best practices on how to handle large datasets in accounting reports? Should I look into code optimizations, or are there alternative methods for efficiently accessing and exporting these reports?

Thank you for your advice!

Avatar
Buang
Jawaban Terbai

Hi,


Your server crashes because generating large Excel reports synchronously overloads worker memory and CPU. To fix this, focus on two solutions:


1- Optimize the Code: Replace slow ORM calls with efficient raw SQL queries in the report's data-fetching method. This lets the database handle the heavy lifting.


2- Change the Process: Implement asynchronous reporting. Use the queue_job module to generate reports in the background. Users get a notification with a download link when the file is ready, preventing server timeouts and crashes.


For immediate relief, encourage users to filter data and view reports as PDFs before exporting to Excel. The long-term, most effective solution is to adopt asynchronous processing.


Hope it helps

Avatar
Buang
Penulis

Thank you for answering queue_job might be the answer I am looking for

Post Terkait Replies Tampilan Aktivitas
1
Sep 25
924
Server Slowness Diselesaikan
2
Mei 25
1191
2
Sep 25
97
1
Sep 25
164
5
Sep 25
1110