79404847

Date: 2025-02-01 11:06:15
Score: 1
Natty:
Report link

It's a bit tricky to use SQLite in Lambda servers. However, @Kamyar Safari is not wrong and he is correct(almost) that the SQLite database is not permanent but it is not the only factor here. I recommend considering other alternatives like MySql/Postgres or ... that are available permanently on another server. Why you can not use it like this:

  1. Lambda servers are TEMPORARY by default and will be destroyed after a time.
  2. Because of lambda concurrency (having multiple servers) you will get inconsistent data and not see the same result for all users.
  3. If you keep the functions reserved then as your database gets bigger your functions get slower and it's more expensive.

What are the solutions?

  1. The easiest is to use the vapor default options like mysql.
  2. Use SQLite with an EFS that mounts permanent storage to your lambda servers
  3. (Highly discourage this one) Using reserved concurrency feature of Lambda functions.

Cons for each one:

For number one 1 can't think anything except changing your configuration.

For the second solution, you to have a good knowledge of AWS. Use these docs for help

The last solution will not solve anything perfectly and It's just for you to experiment with the default configuration. Data still is inconsistent and if you decrease the reserved functions then you lose the data. And also more expensive because the lambda will not be destroyed(this feature is for high-traffic sites, not this issue)

https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Contains question mark (0.5):
  • User mentioned (1): @Kamyar
Posted by: TEFO