Hey!
I know this is a very project dependant question, but when planning a project's architecture do you lean towards one or the other?
I've just put up a proof of concept product using cloud functions because I thought it would be nice and lightweight however now I'm finding that perhaps I should have just gone straight in with a server and built upon that.
Running a server is like second nature to me and I feel I struggle to see how I could best utilize new technology like cloud functions and serverless.
Interested to know what your uses for serverless are and perhaps some insights into how to use it best.
I'm of the belief that you can optimize almost any serverless problem to be significantly cheaper or better as a server-first solution, with some notable exceptions (ETL, video transcoding might be the best examples of things that truly balloon up and down in resource consumption).
However, there's administrative overhead of running servers, and more complexity in prematurely optimizing things.
If you like serverless, use it until you run into problems you can't solve. Vercel monorepos are pretty awesome as far as serverless goes.
What is probably more optimal, unless you have significant experience running servers, is to start serverless and refactor when you see things scaling, and can make sense of what's happening. You will probably find scaling issues that can easily be solved through some kind of caching or database change, or a small code refactor.
Your goal is to delay refactoring as long as humanly possible.
This might not work if you don't have significant experience with a server-first approach. Generally for small projects, it's not worth it to over-engineer or over-optimize things.
Great advice thank you - I signed up to Vercel yesterday going to give it a whirl. I would like to keep my project structure simple and serverless has really helped decouple the elements.
Yeah that makes a lot of sense. A + on lambda is that it provides you with out of the box logging and monitoring also.
We use both. Serverless is great for heavy parallelization as well as for applications that need to scale for traffic spikes, etc. Also, we quite often use AWS Lambda together with API Gatewat and Cognito for implementing RESTful APIs, since the services integrate seamlessly. Whever we can predict our traffic accurately AND we are facing constant traffic, we go for long running servers or containers, especially when there isn't a need for quick scaling operations.
By the end of the day, you can perfectly use Serverless for some parts of your application and Servers or Containers for other, depending on your needs. If you'd like to reduce your Ops overhead after all, you can also chose solutions such as ECS Fargate over running your own instance.
We should not forget that most costs are produced while working on engineering tasks such as implementations or maintenance - try to reduce that overhead whenever you can.
Really appreciate your input - thank you. Yeah, I think an ideal solution for me at least is the one with the least amount of maintenance for the moment. Product is not even off the ground yet so got a ways to go anyway :)
I would say that for a proof of concept, it doesn't at all. Just ship something.
Users won't care if it's serveless, server, or whatever, so for a POC, just ship something as soon as you can.
No need to waste time. And because you are expert in running in server, go for it. Don't loose time to learn how to use and optimize serverless
You are right - my problem is I get caught up in shiny new things because they are trending.
The sentiment of just getting something out there is spot on and I suck at it. Never happy enough to release something.
I've talked myself down on serverless for a few personal projects. The main reason was predictability of costs. With serverless, unpredictable traffic spikes (maybe you make it to the front page on X, or even a malicious actor) could hammer your website/api and cost you a lot of money. Build your application in a scalable language, and a single server could go a long ways.
There's also packages for many languages to transform http handlers (for traditional web applications) into serverless-compatible functions. I don't think that switch is actually that disruptive. Serverless seems like a safer bet once a project reaches profitability/maturity.
Solid argument. I must say I am really torn. I do like the serverless structure so to have something similar in a server environment would be nice.
Personally, everything new I build now I look at serverless first. I find people greatly underestimate the costs (distractions/time wasted) of running/maintaining your own server instead of focusing on building a production / service.
If costs might be an issue (because serverless is more expensive per call), I make sure the architecture could be switched to a Docker container. So, if needed it would be possible to switch back to a more traditional architecture if needed.
i do love serverless.
you can try Cloudflare Worker
I go with PaaS initially. I don't plan that any of my projects are going to take off and just cost a ton of money. So I'll go with Vercel, or Heroku, or whatever. May check out DO's new PaaS.
If I start to get any kind of traction it's not hard to switch to a server.
I move to serverless lately, mostly due to the fact of how little it takes to create a new function.
My product consists of 5-10 "micro" web services, most of them built with asp.net Web API. If I accidentally need a new web service, creating a new one produces too much hassle: from project to packages, to DI setup and etc.
Same time cloud functions can be created by simply writing code in a web window (which I almost never do though), or by adding one file to a functions project.
I'm so impressed with serverless that I plan to incorporate it into my latest product api.chat in some form.
I'm not sure that it should be used for backbone of application, here I really would like to have more control, but for a side services it's the best IMO
With server.
The reason for this is that you are more comfortable with it. Also, if your project is new I am guessing you wont have issue with highly variable traffic like the problem solved with serverless. I am sure there are advantages with serverless here, but it is more important to concentrate on the features of the project (product) :)
Later on, if you have crazy traffic and you think serverless can solve the problem you are facing, then go to serverless. This is a very subjective opinion.
I like doing everything serverless because of two key reasons:
With platforms such as Vercel, you get edge-to-edge caching as well. That means your application is no longer that dependent on location – at least for the end-user. They’ll get near-instant responses, as if the server was placed in their country.
Awesome, thanks for this write-up. Interesting I'd not come across Vercel before but you and another comment mention it. Going to check that out as it could be the answer for me.
Vercel is my go-to at the moment because it’s so easy. Great support and good documentation. Good luck!
Serverless is the way to go.
I've used the Serverless Framework on many projects and find it easy to understand and extremely flexible with its plugin model. The Serverless Framework provides a simple and effective abstraction of the AWS Lambda package and deploy process. GoDaddy has found that by providing developers with self-service, standardized infrastructure templates, they are able to get new projects running faster with less overhead.
I think both options are good and have their own benefits. First of all, if I discuss the pros of server ones then they are the following:
On the contrary, serverless options are the best if you have a limited budget and less time to develop an app. With cloud features, your project wouldn't go down anytime. Serverless frameworks like Parse https://www.back4app.com/product/what-is-parse-server with low coding developing offer many services like REST API tools, social logins, Cron Jobs and much more. In short, it depends on your requirements that what suits you the most.
This article https://www.stonegroup.co.uk/insights/server-vs-serverless-whats-the-best-option/ can also assist you in finding more pros and cons of both server and serverless platforms.
This comment was deleted 4 years ago.
Ahh yes, I had some fun securing my 3 functions and making sure CORS was all good. Unfortunately, Google doesn't support reverse proxy for anything other than the US so you can't have your functions on the same domain as your hosted site in firebase. I wouldn't be surprised if the firebase free tier gets reduced to nothing also, that is a fair point!