Storing every package tarball as an attachment on a CouchDB document is painful. It works fine for a few hundred docs, but at well over a quarter million package versions, this makes view generation and compaction much too onerous, and the file becomes too large to ever successfully compact.
How big is the average npm package? Is this issue due to couchdb's treatment of attachments, or simply due to the size/volume of the packages themselves?
On creation, attachments go into a special _attachments attribute of the document. They are encoded in a JSON structure that holds the name, the content_type and the base64 encoded data of an attachment. A document can have any number of attachments.
attachments are by default stored inline in the document itself
Comments
How big is the average npm package? Is this issue due to couchdb's treatment of attachments, or simply due to the size/volume of the packages themselves?
attachments are by default stored inline in the document itself
That's only when you are initially saving the document. Once the database receives the attachment, it creates a stub and removes the inline data.