What you learn is what you earn! NodeJS Practical Series: How individual developers should choose cloud services

This article is worth at least a thousand dollars, because this is what I conservatively estimate wasted money (please come up with a wry smile emoji by yourself)

The article will be interspersed with some suggestions for choosing cloud services, and of course it will also provide some "sweeping wool" tips. But before that, we need to think about a more important thing: why do I buy cloud services?

Make products or make technology?

This question not only determines your next purchasing strategy, but is also the premise for you to start coding.

The goal I want to achieve with technology as the starting point is: I want to write the code correctly (learn it first), and write the code well (and then become proficient in it). Code is the starting point of all work. The more difficulties in the coding process, the better. The more complex the business scenarios you encounter, the better, and the more familiar you are with the best practices in the industry, the better. The gains are directly proportional to the amount of code actually invested.

If you look at it from the product side, good code does not equal a good product. Verifying the feasibility of the idea is a top priority. Before users pay the bill, people, days, machines, and code are all silent costs. For individual developers, these are losses borne out of their own pockets, so making products quickly is actually the highest priority. I believe you have more or less experienced this kind of contradiction between technology and products: high-quality code is inseparable from time investment, but time is the biggest enemy of a product’s "race to compete" - such a choice is not at all Difficult, the company will not hesitate to sacrifice the former. If you have worked in an Internet start-up company, you must have a deeper understanding. Products and technologies are not binary opposites. You can still deliberately become proficient in a certain technology during product development, but as a product and code author, you need to carefully calculate the costs and returns.

As the title suggests, the perspective of this article is that of an individual (independent) developer. For this group of people, although they have their own coding talents, running a product well is far more important than writing perfect code. In other words, in this article, the primary object served by the "cloud" is the product.

Once you accept the premise of product first, you have to start trying to "overcome" all kinds of code obsessiveness and learn to accept various imperfections in developing products. If I were given the opportunity to rewrite site2share two years ago, I would make a lot of cuts in coding implementation, for example:

  • Use native SQL statements instead of ORM for data storage

  • Don’t write tests

  • Instead of doing CI/CD, choose local compilation, manual compression, and manual upload and deployment.

If you still don’t understand why I advocate all kinds of obvious anti-patterns, just read on.

What services to buy

The correct question to ask should be progressive:

  • Which functions of the product require service support?

  • Can I write these services myself?

  • How to tell or should I buy from a third party?

Start with MVP (Minimum Viable Product)

We need to use product thinking to answer this question. If your website requires a login feature - wait, does your website really need a login feature?

Considering your limited human and financial resources, my suggestion is that before coding, you need to clearly understand which functions of the website must be implemented (Must have) and which are dispensable (Nice to have). The reason why I give you this vaccination in advance is because most products have extremely limited opportunities to be seen by people before they end their lives, and investment in uncertainty will most likely result in waste. Let’s take a look at the following two examples.

ProductHunt is a well-known Internet product release platform in the industry. If it is conservatively estimated that ten products are released here every day, at least 3,650 new products have been launched around the world in the past year - and if you recall, in the past 2022 Are there any new apps that stand out in your memory?

Going back to the site2share example, according to Google Analytics statistics, at least 3,000 new users visited my website in the past year, but only 47 users actually used Google email for OAuth login. This year coincided with Google urging me to upgrade the Google Authentication SDK. Considering the subsequent maintenance costs (for example, purchasing Azure Redis on hardware costs 15 US dollars per month), I chose to completely offline the login function.

 

Returning to the login function, if it is confirmed that it is part of the complete function, before purchasing the infrastructure to support it, you should also consider whether buying is the only way:

  • If the purpose of logging in is to save personalized data, can a solution similar to excalidraw's  local cache (such as localStorage) be used?

  • If the backend needs to save personalized data, can we use a lightweight implementation of the login function, such as integrating OAuth instead of building an account system from scratch?

  • If you are sure to use OAuth, is it a better choice to choose Auth0 directly?

 

The free version of Auth0 supports unlimited logins for up to 7,000 registered users. Maybe you will ask what to do after 7,000 users? I don’t know, that’s because I haven’t gotten that far yet. But I guess by that time, a well-thought-out user system should be put on the agenda, and funds and manpower will no longer be an issue. But before that, let's survive.

Measure hidden costs

Money is not the problem, the problem is lack of money, hence this article. But apart from money, people often ignore the time investment. In the long run, the creation cost does not account for the majority of the code cost, but the maintenance cost does.

For example, if you need to build a crawler now and you must use a proxy pool, should you build it yourself or buy a proxy pool?

There are already many proxy pool open source projects on the market, such as this proxy_pool. The principle of the proxy pool is very simple. Essentially, it is an aggregation service that crawls public proxy libraries on the Internet for you and then stores them together. Back to this issue, I tend to purchase existing proxy services rather than build my own. Taking the deployment of this open source project as an example, self-building will cause me the following difficulties:

  • Need to pick up Python and Docker again, this is the cost of learning

  • My web service is deployed on App Service. If you want to deploy proxy_pool as an independent service, you need to purchase an additional virtual machine.

  • Security, testing, maintenance, and monitoring costs of services

  • Additional development work is required to effectively filter IPs again, because the public IP library is usually of low quality and cannot meet the needs of crawling specified websites and jointly debugging web services.

If you convert your salary on an hourly basis and multiply it by the time you will invest in the above work for a long period of time in the future, it may be more cost-effective to directly use the money to buy a suitable agency service. Because the agent pool is currently a very mature industry, there are a large number of mature players in the industry. Taking the largest bright data as an example, it can not only provide proxy IPs in a more detailed manner, but also write the code for you, directly provide a crawling service API, and support debugging in the browser:

 

Bright data may have some entry barriers, but you can always find an "alternative" that suits you in the industry. Due to competition, everyone provides similar services. For example, for me, I think Geonode's agency service may be more suit me.

What I want to express is that not spending money does not necessarily mean free. Don’t forget that hidden costs need to be taken into account. Having said that, you can still learn a lot by building one manually, and it can be considered as tuition. But my position here is still based on the product. Fast is very important, whether it is move fast or fail fast.

What configuration service should I buy?

After deciding to purchase cloud services, the next question is what configuration of cloud services should be purchased. I have an informal classification of cloud services: managed and non-managed. To put it simply, the unmanaged type does not provide additional value beyond your basic needs. For example, if you need a server, then all it can provide you is only one (virtual machine) server. DigitalOcean's Droplets or Alibaba's ECS fall into this category. There are various types, and there will be subcategories under these product types, such as CPU-optimized type and memory-optimized type. For some, you can choose a pre-installed system or runtime environment when purchasing them, but essentially they are still servers and don't care what you use them for in the future.

On the contrary, in addition to meeting the basic needs of your program, the managed type also provides more additional services. For example, the slogan displayed on the homepage of Digital Ocean's App Platform is "Fully-managed infrastructure", which includes deployment directly from GitHub. , application monitoring, log analysis and other functions. Taking the Azure App Service I am currently using as an example, I can use the following functions on the interface:

 

But the question is, can your application support so many functions? That's right, I'm asking whether your application can support it?

What I purchased is the lowest configuration package Basic B1, which provides a memory capacity of 1.75G. But according to the monitoring statistics provided by the app service, the memory used by my application all year round (memory working set) only requires 140MB. It is taken for granted that the hardware infrastructure will be sufficient to ensure the normal operation of the function for a long time. So I don't need the infrastructure alert in Monitoring (running the alert also costs extra), nor do I need to have a Scale up button on the menu bar for upgrading hardware. As for application-level monitoring, I can use the third-party free service UptimeRobot:

Take Deployment slots as an example, it provides a multi-environment deployment mechanism: you can first create a Staging environment, deploy the code that will be launched into it, and after the test is correct, switch the Staging environment program to the Prod environment with one click. However, as an individual developer running a small business, it is actually a luxury to prepare multiple isolated environments (such as an isolated database environment), and it is also acceptable to deploy downtime for unpopular applications and directly use the online environment for trial and error—— Deployment slots are not strictly needed either.

So as to what kind of cloud service configuration should be purchased, my answer is that it is sufficient and easy to expand . If the virtual machine on Digital Ocean for $4 a month with only 512MB of memory can run your application, then just buy it. At least in the early stages of the project, the benefits brought by managed services are not that obvious, but if one day the existing infrastructure cannot support the traffic, ensuring expansion should not be a difficult task.

How to choose free

There are more "free" cloud services than we think - the quotation marks are because this statement is not accurate. Most services are only free within a certain limit, but in most cases the behavior of individual developers is "grabbing wool" The download cannot reach the free online quota.

I take three free DevOps tools, Alibaba Cloud Effect, Azure DevOps, and GitHub Actions, as examples to explain how I think you should choose free CI/CD tools, with priority from high to low.

  • Familiarity : "Fast" is the theme of this article. If there is any tool that you are already proficient in using in your daily work, it is the first choice

  • Choose an ecosystem : It is best for all cloud services to come from the same provider. If your application is deployed on Azure, then using Azur DevOps is the best choice. It will naturally provide better support, such as a built-in mechanism that allows you to connect your pipeline to cloud services with one click.

  • Added value : Github Actions is most purely focused on CI/CD. But the other two also provide team collaboration and project management functions at the same time, because they advocate the value of DevOps rather than just the pipeline. Yunxiao can even be integrated with the Alibaba ecosystem, such as DingTalk. In the process of using Azur App Service, I found that the log collection tool Application Insights provided by it by default is very easy to use and can satisfy almost all your fantasies about a log tool: it supports multiple programming languages, supports both front-end and distributed tracing, Active collection, and (some) free

  • Development experience : including how easy it is to integrate with third parties, whether it is friendly to troubleshooting problems, etc. One thing to mention: Yunxiao's UI is great and it can also provide free manual consulting services, but it does not support IaC (Infrastructure as code). To me IaC is more important.

  • Core functions : The CI/CD pipeline is an industry standard and everyone has a thorough understanding of it. There’s nothing to worry about here, the difference isn’t huge.

  • Industry status : This reference condition is not specific to these three, and there will not be much difference in this field. But for other cloud services, such as static resource hosting, my experience is that Netlify has a better experience than Azure Static Web Apps and provides more and more professional services. For example, you might consider that many people use Netlify to host single-page applications, and they also provide forms functionality. You can integrate forms on your web pages and submit them to the designated addresses they give, and they will automatically collect them for you. Of course, there is also a free third-party service FormKeep available.

Book recommendations

If you are really interested in making your own application, there are two books worth recommending: Not to mention "Rework", which I think has been published for ten years, and is a classic book by the basecamp team. It brings more moral support and abstract opinions.

The article is reproduced from: hh54188

Original link: https://www.cnblogs.com/hh54188/p/17281772.html

 

Guess you like

Origin blog.csdn.net/sdgfafg_25/article/details/131720348