3

I am building a web/mobile application with Django Rest Framework (DRF) that enables authenticated users to post snippets and/or vote for other user's snippets. All users (authenticated or not) can also get the list of recent snippets (paginated, ex: 5 per page). Snippets, users and votes are stored backend in database.

I'm totally new to serverless architecture so I'm asking the question: is this application a good fit for this kind of architecture? Obviously, my DRF application is built around Web REST APIs which seems to be at first glance a good fit but the authentication part of users and paginated list of snippets let me think it could not be the case.

Can someone enlighten me?

1

2 Answers 2

1

As opposed to serverless, you might be thinking of a microserver architecture.

In either case, you break up the API into smaller pieces. For example have a micro server handle all authentication and authorization requests. So if you have another microserver that returns a list of items specific to a user, you need to call the authorization micro server from the list micro server. Lambas would work in a similar manner.

You could use Django for each microserver. It is also common to use Flask as well. You will need a separate data store for each microserver. However, I am under the impression that Django is not typically used to implement Lambdas.

If you are considering going the microserver route, you might also consider a container service to develop/deploy your micro servers. Something based on Kubernetes like OpenShift.

1
  • Do you mean "microservice architecture"? That would be more service design related, whereas "serverless" is deployment related. Aug 2, 2020 at 20:50
3

'Serverless' is supposed to save you money by running your app via AWS Lambda or similar PASS hosting arrangements.

You pay per api call rather than having a server running 24/7

If your app is called only occasionally then you will save money. But if you app is in constant use you are probably better off with a normal server.

Its a bit more complicated than that, as you will need other things like IP addresses and databases. Really you need to try it both ways and see which is cheaper.

2
  • Thanks for your answer @Ewan, more useful than these non constructive downvotes! But how do you address the authentication and the pagination processes with serverless architectures?
    – Patrick
    Jan 1, 2018 at 19:26
  • Patrick - you are storing state in a database that is shared with different calls. User authentication/authorization could also be handled in you application, or you could use a service such as provided by google. Note there are projects like keycloak that make it easy for you to connect to multiple such services. You might consider prototyping with OpenWhisk. Nov 1, 2021 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.