Activity fetch performance improvement

I have been working on improving the performance and scalability of Intervals.icu. One of the low hanging fruits (well sort of, it was a lot of work) is to replace the text JSON messages passed from the server to the client (over WebSockets) with binary messages. I have done this for all the activity data (biggest payloads). The payloads are typically 8x smaller now and performance is noticeably faster.

It still needs some more real world testing before I turn it on for everyone. If you are a supporter please enable it in /settings (at the bottom of the page):

Screenshot 2024-09-10 at 16.02.48

This setting is per device type (desktop, tablet and mobile). If you have any issues please report them here. If you run into something bad you can turn it off again.

Technical details: I am now using Google Protocol Buffers to encode the activity related WebSocket messages instead of JSON. These are compressed with deflate.

19 Likes

Enabled the binary activity protocol, and activities in list view wouldn’t load after 30 seconds of waiting. Killed browser tab and opened new tab. Same issue. Disabled and disabled binary activities. Changed from list to calendar view. Enabled binary activities. Opened activities in calendar view and wouldn’t load after 30 seconds of waiting. Gave up. MacBook Pro (late 2023) running latest Sonoma 14.6.1.

edit:

@david

Was in a meeting at work. About 30 minutes later I opened Brave Browser and it has no problems viewing Calendar. Opened an activity. Copied the url.

Switched to Safari, opened a new tab and pasted the activity URL into Safari. Safari loaded the activity page. Clicked on Activities and the Calendar view won’t open, looks like this:

with the 1 activity that I had opened via URL, and the other 7 activities missing. And no navigation at top.

Closed the Safari tab, opened a new tab, pasted “intervals.icu/?w=2024-09-02” into url (with full https://) and again nothing:

with never ending loading spinner in upper right corner.

2 Likes

Tx. Thats annoying. The binary protocol doesn’t seem to work on Safari on my Mac either. I did my testing on Chrome mostly. Wasn’t expecting latest Safari to have problems with binary messages over WebSockets.

2 Likes

Safari (iOS) shows the following:
IMG_5893

Will try on Windows (Chrome and Brave) in about 20-mins.

1 Like

Chrome 128.0.6613.138 (Windows) looking fine so far with Binary Protocol :+1:

2 Likes

I’m using Chrome and the overall time taken to have a quick look at activities while switching between many coached athletes is significantly faster.
This makes a big difference.
Thank you @david :pray::blush:

2 Likes

Chrome and Brave, on Windows, is noticeably faster.

About 36 seconds faster to load 4 year history (30s vs 1:06).

Switching between athletes is also quicker.

1 Like

Brave on both Windows and Android phone are working and faster. Especially on Android it is noticeably faster.

Tx everyone. I have fixed the Safari problem and will deploy Thurs AM (GMT+2). When I do that you will need to be running the latest version of the Intervals.icu web app for the binary protocol to work. I have already deployed that so just reload the page at some point to get it.

3 Likes

Loaded 5 year history (Sep 12th 2020 - today) with ‘Binary Activity Protocol’ selected and again with it deselected. I refreshed activity page between tests so I’d be starting from same base point.

1159 activities loaded in 5s with ‘Binary Activity Protocol’ selected and 9s for the same 1159 activities to load with it deselected.

Running on Windows 10 with Firefox Browser

1 Like

I have implemented a binary protocol for wellness data. This is less than activities but will still help performance.

I also added version numbers at the bottom of the /settings page so you can check you are on the latest version. The version is a UTC timestamp of when the app was built and the “Commit Hash” tells me exactly what was changed in that build.

The app is supposed to update to new versions automatically in the background. Unfortunately this is browser dependent and quite a lot of people are running old versions.

1 Like

I can’ t remember ever having to reload for newer version. Brave seems to do is autmatically.

1 Like

In Chrome it is noticeably faster. Considerable difference. I have not used it in other browsers. I tested it in Edge and it is also much faster. No errors to report.

Configuration (Win 11, Core i5, Chrome, Edge)

1 Like

Safari (iOS) is working, but I haven’t checked the speed.

I only use my mobile version to complete my daily wellness and RPE/Feel data, or to manually move a workout (for athletes) when required. Screen is too small for these aging eyes :blush:

1 Like

Safari on iOS is much faster than before for me. A huge improvement… :grinning:

1 Like

Really fast, now I can keep Calendar view and pull up previous years almost instantly (before, I had to use list view).

However if I:

  • pull up an activity older than last week
  • then click Activities on left navigation

nothing appears:

until I manually force a page refresh, and then calendar appears.

Latest iOS and macOS

1 Like

Checked calendar view loading this morning. Notably faster. It loads instantly. Zero lag.

1 Like

Thanks. I just fixed that bug. It was unrelated to this protocol stuff but a result of the deep-linking work I did a little while ago.

I have added binary protocol support for events (races, planned workouts etc.). This will help athletes with a lot of non-activity stuff on their calendar.

Screenshot 2024-09-13 at 08.39.13

Thank you.

The performance improvement is huge. Really appreciate having a very responsive site when pulling up workouts from past seasons.

1 Like

I just enabled binary protocol for activity, wellness and events. FYI, I use hardened Firefox.

1 Like