Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some questions about the use of Mosquitto storage #2733

Closed
Xxm-YX opened this issue Jan 19, 2023 · 3 comments
Closed

Some questions about the use of Mosquitto storage #2733

Xxm-YX opened this issue Jan 19, 2023 · 3 comments

Comments

@Xxm-YX
Copy link

Xxm-YX commented Jan 19, 2023

I want to ask a few questions

1.Mosquitto's session is stored in memory or on the hard disk

2.Whether the session data will be affected by the max_queued_messages configuration. When the client is disconnected, whether the message received by the broker exceeds the maximum queue length will also discard the message

3.When I set cleanSession = false, persistence = true, the broker sent a restart, whether the session information will be persisted to the hard disk, and whether it can be restored to the state before the restart

@NorbertHeusser
Copy link
Contributor

Hi,

trying to answer your questions:

  1. The session information for sessions started with cleanSession=false will be hold in memory. If the persistence of the broker is activated using persistence=true the broker will write the state of all sessions to disk periodically. But writing the persistent snapshot does not scale well with the volume of messages being in flight. On the develoment branch an additional persistence storage plugin API together with a SQLite plugin was added, which will instead use incremental inserts into SQLIte to store the state. In both implementations the broker will write the current state to disk on graceful shutdown. The state will be restored from disk with the next start of the broker.
  2. If the a client with cleanSession=false is disconnected the broker will queue messages for the client in memory (and store to disk a descibed in 1.). Once the max_queued_messages limit for a client is reached the broker will start dropping new messages for this client.
  3. As described in 1. the broker will store the in-memory state to disk, if persistence is enabled for the broker or a persistence plugin in configured in the config.

Hope this answers your questions.

@ralight
Copy link
Contributor

ralight commented Apr 8, 2023

Closing thanks to the answer above.

@ralight ralight closed this as completed Apr 8, 2023
@sivann
Copy link

sivann commented Apr 21, 2023

@NorbertHeusser do you have more info about the SQLITE storage plugin? We are very interested in this to reduce I/O in case of lots of persisted messages.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants