Skip to content

Commit

Permalink
Add performance/query caching docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Jan 27, 2024
1 parent 9adc5e7 commit 45f4ae1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
15 changes: 15 additions & 0 deletions docs/docs/content/maintenance/performance.md
@@ -0,0 +1,15 @@
# Performance

listmonk is built to be highly performant and can handle millions of subscribers with minimal system resources.

However, as the Postgres database grows—with a large number of subscribers, campaign views, and click records—it can significantly slow down certain aspects of the program, particularly in counting records and aggregating various statistics. For instance, loading admin pages that do these aggregations can take tens of seconds if the database has millions of subscribers.

- Aggregate counts, statistics, and charts on the landing dashboard.
- Subscriber count beside every list on the Lists page.
- Total subscriber count on the Subscribers page.

However, at that scale, viewing the exact number of subscribers or statistics every time the admin panel is accessed becomes mostly unnecessary. On installations with millions of subscribers, where the above pages do not load instantly, it is highly recommended to turn on the `Settings -> Performance -> Cache slow database queries` option.

## Slow query caching

When this option is enabled, the subscriber counts on the Lists page, the Subscribers page, and the statistics on the dashboard, etc., are no longer counted in real-time in the database. Instead, they are updated periodically and cached, resulting in a massive performance boost. The periodicity can be configured on the Settings -> Performance page using a standard crontab expression (default: `0 3 * * *`, which means 3 AM daily). Use a tool like [crontab.guru](https://crontab.guru) for easily generating a desired crontab expression.
3 changes: 3 additions & 0 deletions docs/docs/mkdocs.yml
Expand Up @@ -54,12 +54,15 @@ nav:
- "Internationalization": "i18n.md"
- "Integrating with external systems": external-integration.md
- "API":
- "Introduction": apis/apis.md
- "Subscribers": apis/subscribers.md
- "Lists": apis/lists.md
- "Import": apis/import.md
- "Campaigns": apis/campaigns.md
- "Media": apis/media.md
- "Templates": apis/templates.md
- "Transactional": apis/transactional.md
- "Maintenance":
- "Performance": maintenance/performance.md
- "Contributions":
- "Developer setup": developer-setup.md
2 changes: 1 addition & 1 deletion frontend/src/views/Dashboard.vue
Expand Up @@ -139,7 +139,7 @@
</div><!-- tile block -->
<p v-if="settings['app.cache_slow_queries']" class="has-text-grey">
*{{ $t('globals.messages.slowQueriesCached') }}
<a href="https://listmonk.app/docs/performance/query-caching" target="_blank" rel="noopener noreferer"
<a href="https://listmonk.app/maintenance/performance/" target="_blank" rel="noopener noreferer"
class="has-text-grey">
<b-icon icon="link-variant" /> {{ $t('globals.buttons.learnMore') }}
</a>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/Lists.vue
Expand Up @@ -145,7 +145,7 @@

<p v-if="settings['app.cache_slow_queries']" class="has-text-grey">
*{{ $t('globals.messages.slowQueriesCached') }}
<a href="https://listmonk.app/docs/performance/query-caching" target="_blank" rel="noopener noreferer"
<a href="https://listmonk.app/maintenance/performance/" target="_blank" rel="noopener noreferer"
class="has-text-grey">
<b-icon icon="link-variant" /> {{ $t('globals.buttons.learnMore') }}
</a>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/settings/performance.vue
Expand Up @@ -69,7 +69,7 @@
</div>
<div class="column">
<br /><br />
<a href="https://listmonk.app/docs/performance/query-caching" target="_blank" rel="noopener noreferer">
<a href="https://listmonk.app/maintenance/performance/" target="_blank" rel="noopener noreferer">
<b-icon icon="link-variant" /> {{ $t('globals.buttons.learnMore') }}
</a>
</div>
Expand Down

0 comments on commit 45f4ae1

Please sign in to comment.