Question regarding desiredCount for Grafana task
emmanuelnk opened this issue · 1 comments
Hi, thanks for this sample.
I've currently implemented it successfully. I do have one question though:
aws-cdk-grafana/lib/cdk-grafana-stack.ts
Line 170 in 8e2c25d
Is there a particular reason one should prevent multiple Grafana tasks from writing to the same shared file system? Whats wrong with multiple tasks writing to the same file system? I've searched for any documentation on this issue but turned up with nothing. Did you run into any issues running multiple tasks with the same file system?
By default Grafana uses sqlite3 as it's configuration database, which it what this example uses. This example uses EFS to provide a persistent file store, which is essentially a NFS file share. SQLite can be corrupted on a NFS share if multiple threads (containers in this example) attempt to write to the same file: See section 2.1 of their documentation. Hence the example only allows 1 container online at a time, should a failure occur, the service will quickly launch a new container to replace the failed one; resulting in only minimal downtime of Grafana and no loss of data.
If you really do need 2+ Grafana containers online, this the example can be extended to use RDS or Aurora MySQL/Postgres (Grafana supports both) to host the configuration database instead of SQLite on EFS. Or take a look at the new Amazon Managed Service for Grafana