Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
288 Представления

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!

Аватар
Отменить
Лучший ответ

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

Аватар
Отменить
Автор

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

Related Posts Ответы Просмотры Активность
1
сент. 25
781
Server Slowness Решено
2
мая 25
1074
3
сент. 25
206
1
сент. 25
198
3
сент. 25
1388