Cloud Functions VS Lambda
Many articles are talking about the differences between GCP and AWS. Is that true one is superior to another? Or they are just apples and oranges? For me, I never treat them seriously, as my daily job is heavily on GCP. However, recently I got a project which needs to integrate these two cloud providers’ services. Now the headache is coming.
This comparison is based on a developer perspective, who is fresh to AWS and expert (self-claimed) in GCP.
Both can start coding without documents when using the first time. I feel this is a great advantage to move product to cloud, saving tons of development time.
However, I feel Cloud Function is simpler, agile, and more intuitive compared to Lambda based on the following:
- Lambda needs to set API gateway in order to trigger it by URL
- Lambda does not support install Python packages, to do so, you have to upload your code with packages in a zip or build a customized runtime environment.
- Lambda HTTP trigger passes in the request within a wrapper, not raw request with body and header info. So need to understand its parameter structures.
- Lambda has to enable the binary support for certain content types.
- Lambda built-in editor does not support uploaded zip with too many files.
So the winner is obvious, Cloud Function is the better choice if you don’t want to deal with package installation or HTTP trigger settings.
This one I have to say that AWS has impressed me. Every time if I clicked the save, the code has already deployed, although this comes with a drawback that less customizability. I enjoy this fast and non-interrupted deployment process. Almost every service could be instantly provisioned, modified, and deleted. (So far our codebase is relatively small like ~500 lines of code for each service)
So what does the GCP lack?
- Most services under GCP need several minutes to provision.
- Cloud Functions take a couple of minutes to deploy a new version, even just change a line of comment.
- Searching for other services feels slower than AWS.
All in all, GCP feels slower in many aspects, so AWS has a smoother user experience.
Lambda auto wins this track, due to an on-going log issue in Cloud Functions, which causes no logging when function crashes. Besides the issue, both provide detailed trace logs. Moreover, Lambda provides a configurable test event to run the function on the fly, which really neat.
This won’t affect the user experience for experts, but definitely a plus for newcomers. Maybe just because I’m newbie to AWS, I always find it difficult to read the official documents.
- There is no programming language switcher in the code section, you always need to find a dedicated page for a specific programming language.
- Most operations have to use CLI, which creates a barrier for people like me who just would like to try and do not want to mess up our dev machine.
- No Cloud Shell. A similar reason to the previous one. Although this is not a doc, it is nice to try the tutorials in a setup environment, so less weird errors due to package versioning.
Actually, cloud techniques are pretty alike among providers. Although the under table infrastructures may differ, the user-level implementations do not vary too much. With better doc would attract more people who are new to the cloud. From this perspective, GCP did a very good job of providing tutorials and tools.
This influences the least to developers. It is no good or bad, it is all depending on the traffic volume and the boss’s preferences.
|Pricing||1M/month requests and 400K GB-sec/month compute time for free, then $0.20/1M requests and $0.00001667/GB-sec||2M/month requests and (400K GB-sec/month, 200K GHz-sec/month) compute time for free, then $0.40/1M invocations, plus $0.0000025/GB-sec and $0.00001/GHz-sec|
Cloud Functions have a more complex formula to calculate the compute time pricing. Basically, it adds the CPU usage (GHz-sec) into the calculation. So Lambda is cheaper if not using the provisioned concurrency, which charges extra cost.
Here comes the question, does Cloud Function have a similar provisioned concurrency feature?
This is a general talk about how to integrate services on different cloud platforms, not specified to cloud functions or lambda.
Both products are integrated well with other cloud products within the same cloud provider. Unless there is a unique cloud service, most development could be done within a single cloud provider. If you feel the developers do not have enough work, distribute your services into two or three cloud providers. They will spend most of their time on how to integrate those services, instead of actual development.
This comparison is based on my personal experience. Both have advantages and disadvantages, please choose based on your use cases. But keep in mind, don’t try to integrate them! This is the only advice I learned from using both.