C5DD6A6C-6BEB-4545-8D02-121D85387006.png

I’ve been moving over from Notion to AFFiNE and the docker container kept crashing.

TLDR: if you’re not using the AI features, turn off the copilot process in AFFiNE.

Specifically it ran out of memory through a JS heap error. The culprit was the copilot function, which was embedding all of my notes so an AI tool could use it.

Since I have no intention of using any AI services with AFFiNE, I turned this off.

This took the ram consumption down from 4GB (!!) to around 450MB.

Pasted Graphic 1.png

Full disclosure: I turned on Copilot to see what would happen to Memory usage with or without it. This is about as clear a picture as you can paint.

I initially tried to solve this by giving AFFiNE more memory but it just kept chewing through whatever I allocated - all the way up to 6GB.

Making the Copilot change required 1 addition to the config.js file

"copilot": {
  "enabled": false
}

What does Copilot do in AFFiNE?

Copilot is not the normal editor or sync system. It provides AFFiNE’s ai abilities for stuff like chat, document embeddings, reranking, image generation, audio transcription, coding and text-generation task - none of which interest me.

In practical terms, turning it off means:

  • Normal AFFiNE stays: pages, workspaces, editing, syncing, authentication and storage should continue to work independently of Copilot.
  • AI features go away: things like AI chat, AI-generated/summarised text and other Copilot functions will no longer work.
  • Document embedding stops: AFFiNE should stop generating AI vector embeddings of your documents in the background. Those embeddings are used to give AI features searchable/contextual knowledge of your workspace. AFFiNE has an active embedding pipeline specifically tied to Copilot.

Disabling copilot removes the spikes in memory consumption which was causing AFFiNE to crash, but it also lowers the baseline memory usage in general.

Pasted Graphic 2.png

You’re welcome, random stranger who might find this when they’re fighting with AFFiNE.

Written by

Lester Hein

Lester Hein

Behavioural Marketing Guy