mirror of
https://github.com/axllent/mailpit.git
synced 2026-04-26 16:56:00 +03:00
[GH-ISSUE #218] Monitor drive space #146
Labels
No labels
awaiting feedback
bug
docker
documentation
enhancement
github_actions
invalid
pull-request
question
stale
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/mailpit#146
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sdrakey on GitHub (Dec 26, 2023).
Original GitHub issue: https://github.com/axllent/mailpit/issues/218
Would just like to say great work on this.
I have mailpit running on it's own drive, so as not to use all the space if someone decides to test sending thousands of mails.
I see that there is an option to limit the number of messages in the database, but would it be possible have mailpit monitor a drive and remove the oldest messages to keep the free space below a certain size or percentage.
I used inbucket before moving to mailpit and it had a status page which showed the amount of messages in mail store, message per minute etc, would that be possible on sidebar ?
Is there any instructions for compiling mailpit on/for windows ?
Thanks
Simon
@axllent commented on GitHub (Dec 26, 2023):
Thanks for using Mailpit!
This is an interesting approach. however I do not think it would work, at least not reliably, as different filesystems and operating systems report used size differently. But let's explore this approach a little further:
Let's say I set a 10MB limit - I receive 100 small messages, well below the 10MB limit, and then an hour later I get an 11MB message - all messages then get automatically deleted because the latest one pushed it over the limit?
There are further technical complications/limitations to this approach too - messages are stored using zstd compression in Mailpit's SQLite database, meaning there is no way to actually pre-determine the actual size of any message's disk storage. A 10MB message may only take up 1MB of actual storage space, but it could also take up 10MB depending on the content of that message (eg: an image attachment vs: a large plain text message).
Then there is also the fact that these messages are all stored within SQLite, and SQLite does not automatically reduce in size when messages are deleted. In order to reduce the size of SQLite an expensive CPU & disk operation is required to
VACUUMthe database. Depending on the size of the database, this process can take anywhere between a few milliseconds to several minutes. During this time for large databases, the database becomes very slow.This means that the only way this proposal could work would be to delete individual messages, and after each delete a database
VACUUM. This would lead to all kinds of very serious performance issues. At the moment Mailpit does automaticallyVACUUMthe database after any message deletes, but only after 5 minutes of inactivity as to minimise performance issues.I think you can see how this proposal would not work.
Mailpit has some statistics when you click the "About" link at the bottom, but I will investigate adding some other data to that. This cannot be refreshed very often though as each time those statistics are "refreshed" Mailpit does a check to see if it is the latest version - meaning Github would get a lot of connections if this was refreshed every second or so.
Not on Windows specifically (and I do not use Windows), but there are instructions in the docs which should apply to all platforms.