I am currently working on serverless application that doesn't scale XD

  • 2
    Curious, please explain
  • 4
    Umm... I think you're doing it wrong somehow🤨
  • 0
    That may be ok, if it's a hobbyist type project and your main concern is scaling to zero because of cost, rather than scaling to infinity quickly.

    If it's an enterprise project then yeah... that's bad.
  • 1
    @C0D4 Yeah, to be honest I'm @AlwaysSkeptical, but it does seem wrong
  • 0
    Functions/lambdas were used because they are advertised as "free". However the whole architecture is just monolith. Since everything is driven by http calls the whole app has no resilience.
    But Db kills it completely. Why?
    If you upload an image, every 5s on ui http call is made to lambda that checks if another lambda already completed its task. And this is done by checking state of job in table "Job". But the worst thing is when one lambda is waiting for another lambda. This is done the same way as described above. Even if we have multiple instances of lambdas running in the cloud, there is still only ONE db that rules them all. More lambdas running in same time = worse performance.
  • 1
    I don't think you're doing it right.
    Lambdas calling other lambdas is one of the biggest anti-patterns in serverless.
    Also, your database should be able to scale as well. If you're in AWS, Dynamo is great, or there is Aurora Serverless which autoscales.
    Also instead of polling I would recommend using We sockets from your frontend so it can receive a message the job is done
  • 0
    Should be WebSockets
  • 0
    This is not what we did :D Previous devs were fired and right now my team and I are tying to patch this software. We are aware of all issues and we are doing what almost the same as you wrote.
  • 1
    Ah, that's always fun!
    I would suggest a different pattern for uploading images as well.
    Use the lambda to ask S3 for a generated and signed url, give that to your client and let them do the upload to that. Much more secure and performant.
Add Comment