4
15 Comments

DB recommendation for serverless app

Hey fellow hackers,

I'm implementing a serverless app for my startup and I already have most of the backend working with AWS + Serverless.

I am now hooking Amazon's DynamoDB to my Lambdas and it feels like a nightmare of a product.

Question (for those well-versed with Dynamo): Is there light at the end of the tunnel with Dynamo? or is it just a fucked up product that you'd be wise to replace with some other better alternative?

The main selling point is the fact that Dynamo seems to be the only true serverless DB out there. The other ones require you to provision your own server(s) and deal with perf tuning and scaling.

Any pointers are more than welcome.

Cheers,

on May 24, 2020
  1. 3

    You can checkout the various managed DB providers. These providers remove the necessity to perform admin tasks. They provide production ready DB with auto scaling, auto backup functionalities. AWS, Google Cloud, DigitalOcean, Render are some notable providers.

    Also, checkout FaunaDB. It is a serverless DB making waves in the industry.

    There is AWS Aurora serverless. This is worth looking into as well.

    1. 1

      I'm going to give both a try, thanks.

  2. 1

    Came harperdb.io the other day, they seem to do their managed hosting in AWS, but only in the US. They claim to be very serverless and all their API's are HTTP based which i really like. Maybe that could be an alternative

  3. 1

    If you are well versed with AWS and prefer to use that, dynamoDb is okay. It gives good performance. Otherwise firebase is another good one. Depends on the kind of data you wanna store. Is it relational or is it timeseries data.

  4. 1

    From working with three serverless projects on aws and using dynamodb, i can confidently say that if you want quick db and you know your schema from the start its fine, but the second you want to use it with appsync it becomes horrible, no count/sum queries, no normal batch insert, no select by ids, resolvers are a nightmare. I would stick to a simple rds

  5. 1

    DynamoDB has a quite long learning curve, have you considered https://aws.amazon.com/rds/aurora/serverless/ ?

  6. 1

    Thank you all for your pointers. After researching DynamoDB some more I think I'm going to stay the hell away from it. It has a complicated pricing model, very inflexible and cumbersome API and overall shitty dev experience.

    I will probably give FaunaDB a try and see where that leads.

    Cheers,

  7. 1

    It would be helpful to hear about your use case and how Dynamo is difficult to use. That generally hasn't been my experience, but different use-cases do benefit from different databases.

    It certainly isn't the only "serverless" (fully managed) database on AWS- there's also Redshift and SimpleDB (I never used this one).

    1. 1

      I have a very simple use case. Just two tables, no joining required, no blobs or binary data.

      I guess I just feel like the product's ergonomics are god-awful. The developer experience feels very frustrating, having to write scripts instead of having some form of query language to operate on your data. The nosql workbench is garbage, the local shell is garbage, there are inconsistencies between the docs and actual DB behavior, etc. It feels like I'm working with some sort of archaic piece of software that's going to blow up in my face in production due to a bunch of unneeded complexity.

      I suppose I'm a bit burned out as well at this point with the stupid learning curve that AWS requires. Am I being a bitch? Or are there solid reasons to stick with it?

      1. 1

        Hm, I have observed that different versions of SDKs have been slightly out of date with the documentation. What language/sdk are you using? Feel free to reach out with tech questions.

        Never tried using the nosql workbench or local shell, can't really help with those.

        I definitely felt AWS took time to learn, but once you get it down it's fairly flexible and powerful. I appreciate knowing it, and it's my choice of cloud for projects. I haven't really really tried out other cloud options though.

        1. 1

          Thanks for the reply. I am coding mostly in Node and some Python.

          Could you share what rough development workflow you use around DynamoDB?

          For context, I run both Lambda and DynamoDB locally via Docker so I can write real Lambda functions that interact with Dynamo via the Node.js AWS SDK. I then deploy via the Serverless framework.

          What does your AWS development cycle looks like?

          1. 2

            I've been using Dynamo/AWS for about five years now, so I've used it for many use cases :)

            But I use it whenever I need fast read/write key-value lookup, and especially when it will be potentially need to scale to handling a lot of requests.

            I've never tried running Dynamo locally, and never used the serverless framework.

            I am NOT advocating for this as a development workflow- but to move faster, I'd just create a lambda in the aws console and write code in there directly, testing my connection to dynamo. It'll be faster to test whether code works.

            Tip for trying to figure out syntax when the sdk doesn't match the documentation- check out the Typescript "types" package of the sdk. It has static typing, so the format of requests/responses are well defined.

            1. 1

              Got it. Thanks a lot for sharing.

          2. 1

            I used dynamo before and it worked really well. But you can not use it as RDB. It's a key/value DB with limited indexing and you need to plan for this. If you need complex searching dynamo is not for you. If you always have a key to search by it's great.