moquette-io / moquette

Java MQTT lightweight broker
http://moquette-io.github.io/moquette/
Apache License 2.0
2.27k stars 814 forks source link

Optimised page file opening #837

Closed hylkevds closed 1 month ago

hylkevds commented 2 months ago

Instead of mapping the entire page file every time a segment is re-used, we map the page file once, and re-use the mapped buffer for each segment. The cache uses WeakReferences to ensure that a page file that is no longer used does not stay mapped.

hylkevds commented 2 months ago

It seems the 200ms timeout on creating subscriptions is sometimes not enough on the GitHub CI environment: https://github.com/moquette-io/moquette/blob/2092693c5d9d5bcb0468631416d064c3707ffa32/broker/src/test/java/io/moquette/testclient/Client.java#L211

Do you want me to create a PR to increase it to 300?

andsel commented 1 month ago

Thank's @hylkevds for your contribution!