nextcloud / calendar

📆 Calendar app for Nextcloud
https://apps.nextcloud.com/apps/calendar
GNU Affero General Public License v3.0
954 stars 233 forks source link

The calendar screen is displayed slowly #5421

Open zhiqi-23 opened 11 months ago

zhiqi-23 commented 11 months ago

Is your feature request related to a problem? Please describe.

When I prepare a calendar table with more than 1000 events(not a recurring event), open it in month view, the current month has 360 events, an average of 12 events per day, and then click the calendar button, it takes about 6 seconds to display the calendar screen. Nextcloud version: 24.0.3. Calendar app version: 3.5.4 and 3.5.7. image2023-8-21_17-16-10

Describe the solution you'd like

I want to improve the display speed of the calendar screen.

Describe alternatives you've considered

No response.

Additional context

No response.

miaulalala commented 11 months ago

Can you share your script on how to fill the tables so I can reproduce?

zhiqi-23 commented 11 months ago

@miaulalala schedule.zip

miaulalala commented 11 months ago

Merci!

niclasheinz commented 3 weeks ago

@miaulalala Is there a way to fix that. I've the same problem with NC29. I'm using around 6 different calendars. If I switch to another month or reloading the whole page, the calendar takes 7 seconds to load.

miaulalala commented 2 weeks ago

@miaulalala Is there a way to fix that. I've the same problem with NC29. I'm using around 6 different calendars. If I switch to another month or reloading the whole page, the calendar takes 7 seconds to load.

We could cache the DAV responses maybe? The issue is that for every calendar the following queries are run (you can observe them in your browser):

POPFIND on the DAV endpoint which gives us the principal PROPFIND on principal to get the collection of calendars For each calendar a PROPFIND for the entire timespan of the view to get the VCALENDAR (which, underlying is doing a select on oc_calendar_objects to build the VCALENDAR response)

Then the frontend has to parse the whole VCALENDAR into each VEVENT and slot it into the calendar grid.

So it's simply a lot of data to process.

I think there's already some caching for the DAV backend if I'm not mistaken, but fullcalendar struggles with lots of events. Maybe @st3iny has some idea?

niclasheinz commented 2 weeks ago

Then the frontend has to parse the whole VCALENDAR into each VEVENT and slot it into the calendar grid.

Thanks for the reply, @miaulalala! Is there a way to improve performance with cronjobs or something else?

miaulalala commented 2 weeks ago

No unfortunately not, since this is purely how many requests are sent from the frontend to the backend and then how many events are returned and need to be parsed to be displayed.

niclasheinz commented 2 weeks ago

And how does the professional hosting provider speed up the NC calendar?