I was sure it would slow down at 24 million things. It took 24 ms
ยท Kai Gilb

In story 3 crate 42 got a type. A crate that knows what it is is only useful if you can find it again. So, story 4: what happens to speed when a vault gets full.
Anyone is fast on an empty demo
AI is very good at getting an app on screen. Ten records, two users, one crate of sample bananas. Fast.
Now do the sums for a real farm. Banano Vargas Farm ships 25,000 crates a week. Each crate is scanned three times: at the farm, in Rotterdam and in Oslo. That is 75,000 new records a week, and almost 4 million a year. In six years the farm's vault holds about 24 million things.
Most apps are tested on day one. The farm lives in year six.

The test: same question, bigger pile
So we built the pile. We filled one store with 10,000 things and asked a question. Then we threw it away, filled it with 100,000 and asked the same question. Then 1 million, 2 million, 10 million and 24 million.
The question was always the same: find the 500 records this app is allowed to see, and get them ready to show. That is the question a real app asks all day. Not "give me everything". Give me what I need, and only what I may see.
| Things in the store | Time to answer |
|---|---|
| 10,000 | 17 ms |
| 100,000 | 21 ms |
| 1 million | 21 ms |
| 2 million | 23 ms |
| 10 million | 23 ms |
| 24 million | 24 ms |
2,400 times more things. 1.4 times the time.

I was sure it would slow down. I have built systems for a long time, and I know what happens when the pile grows. I was wrong, and for once I enjoyed it.
Why the pile does not matter
Think of the tabs on the side of a dictionary. You do not read from "aardvark" to find "banana". You go to B.

Every record on GilbPlatform is filed like that from the moment it is made. When an app asks for crate 42, the server goes straight to it. The other 23,999,999 things are not read. They are not in the way.
That is why the farm's app can answer as fast in the last week of the season as on the first day.
When the answer itself is big
Now the other half, because I promised to tell you what is not done.
In the same store of 24 million things, we asked a second question: give me every record that mentions Bergen. In our test data that is about 2 million records, and each one has to be checked: may this app see it?
That took 1 minute and 42 seconds.
The store was not slow. The answer was big. Two million records are two million records, in any system. So here is the rule:
Speed follows the size of the answer, not the size of the vault.

What we have done about big answers since August:
- Lists come in pages. The first page of a list of 1,000,000 records now comes in 8 ms. It took 134 ms before (weekly note, 27 October).
- Page 5,000 costs the same as page 1. 13 ms instead of 17 seconds (weekly note, 3 November).
- Reading everything works, but takes time. All 1,000,000 records of one type come back in 4 minutes 24 seconds. Before, it never finished.

So an app that asks for a page gets it fast. An app that asks for all 2 million at once still waits. That is true on every platform. The difference here is that we measured it, and now you know.
What this means for the farm
When the scanner in Rotterdam reads crate 42, the app asks for one crate, not every crate the farm has ever shipped. One crate in six years of crates: about the same time as one crate in the first week.
When the farm wants its numbers for the whole season, that is a big answer. It comes page by page, or the app works it out ahead of time. That part is the app's design, and it is worth thinking about before the season, not in it.
What is not done
- These numbers are from August, on my own laptop. We measured on 17 August, on a MacBook Pro (M5 Pro, 64 GB), with made-up records. Not on the server you would use, and not with real farms.
- Production has no vault this full yet. Our server in Helsinki has not been measured with 24 million things. When it is, I will publish that number, whatever it is.
- Past about 45 million things, we have not measured. At 24 million the whole store still fit in the laptop's memory. A store that does not fit has to read from disk, and that is slower. We have not built that pile yet.
- Big answers are still slow. 2 million matches took 1 minute 42 seconds in August. That case has not been measured again since the speed work in October and November.
- What you feel in the app is more than the store. On 2 November, a reload of GilbApp still took about 2 seconds before the first row showed, mostly the sign-in check (Speed Lab). Our limit is 1 second, so we are not done there either.
Next: made to last
A vault that is fast in year six is worth little if year one has been changed behind your back. Story 5: why every value is filed under its own fingerprint, and nothing gets quietly overwritten.
To get the next story, follow the News RSS feed. Want to be among the first to get a vault?
Kai Gilb
