Peter Chen

Peter Chen

https://blog.peterchen97.cn/about/index.html

It's been a year since the blog was set up!

It's been a year since this blog site was built! So it's a good opportunity to review my personal thoughts on building a blog after a year, and I've also made a few small adjustments to the blog's deployment that I can share with everyone, haha.

Review#

Looking back at the article I wrote last year, I still feel quite touched:

...

What can a Blog bring us#

  • Personal Branding: This is most evident on a technical level; most tech leaders have their own blog sites, where they record and share many high-quality analyses and conclusions. Just flipping through the blog list can yield a lot of insights.
  • Low Barrier to Writing Costs: Here, I mainly think about the threshold for the quality of content I write. Sharing various articles on most existing social platforms often requires repeated modifications and processing of the content. Many ideas I want to share feel not worth writing after going through this invisible cost, and those sporadic sparks might just extinguish, which is a bit regrettable.
  • Freedom
    • Product Practice: I believe many of you have suggested optimizations for the reading experience on certain platforms more than once. This color scheme is bad, that ad is annoying, this ecosystem is closed, that review is strict. A blog provides a relatively free canvas to realize some of your ideas. For products, a personal blog is a small product; it can encompass all your thoughts on this form of content carrier. Though small, it has all the essentials.
    • Technical Implementation: For programmers, self-hosting a site is the best entry point for technical practice. If you want, a blog internally contains almost all the technical scenarios and stacks you can try; it's a great training ground.

...

After a year, I have some new thoughts on the above points, especially regarding personal branding and writing thresholds:

Personal Branding#

I realized this point when I saw a Feishu document this year; it's really useful for meeting new friends.

💡 Tao Chenyu's Personal Manual is a Feishu document that details her personal information. It feels like you can quickly understand a friend through the document, which is quite nice. However, it seems this version has deleted a lot of self-introduction, perhaps because too many people wanted to get to know her, haha.

picture 3

Actually, many times when you introduce yourself, different friends have very different levels of acceptance of this information. It's very likely that when you introduce yourself, interested friends feel you said too little and are left wanting more, but they don't know how to get to the points they're interested in. This can be quite awkward, and new friends might think you're a bit introverted and have no hobbies, which could lead to missing the opportunity to meet like-minded friends.

The opposite is also true. If new friends aren't very interested in getting to know you, and you ramble on, the other party probably won't get it either, and it can lead to you thinking your introduction is meaningless, affecting your ability to meet new friends later, which is also quite awkward, haha.

Getting to know someone through a blog or article is actually a slow-paced asynchronous social method. In today's society, everyone has their own rhythm and way of processing information. So when you introduce yourself and pull out your blog, that will be a killer move, haha (see my about page here).

picture 4

So this year, when meeting new friends, I also tried this method and found it quite good, haha.

Low Writing Cost#

This really has an impact, one being the resistance to writing and the other being the pressure to publish.

The resistance feels like it's still in a waiting-for-the-right-time phase, and I don't have a good method to overcome it, haha. I still need to learn more.

However, writing a blog significantly reduces the pressure to publish. For example, my COVID Record feels inappropriate to post on general channels, but on my own blog, it's different; it's more casual. Writing on my blog feels like having friends come to my house, which makes me more relaxed; writing on a platform feels like going to someone else's house, which makes me more reserved, haha.

picture 5

But this article will be content I want to look back on years later, and it will definitely help friends who are interested in it. If I didn't have a blog, I might have lost some memorable moments in my life, which would be a pity.

Insights#

Buy Yourself a Few More Baskets to Hold Things#

There's a theory that says: if you have a hammer in hand, everything looks like a nail.

picture 6

However, from my experience of writing a blog for a year, this theory might have a second half: But in most cases, if you don't have a hammer, you won't even see the nails.

The human brain actually uses a very energy-efficient algorithm. When faced with things you don't need to understand, the brain will directly place that information at the end of the priority queue. If you don't have the energy to process it, it will be discarded. But if you have a hammer in hand, that priority increases, and you might notice it. For example, the classic Pregnancy Effect (the more you focus on something, the more it appears).

In the past year of blogging, I've discovered many excellent blog sites. In previous visits, I might have entered through searching for technical issues, read the problem, and left. However, as I thought more about my own blog, I also gained more information from others' blogs.

For example, I slowly began to pay attention to various details of these blogs, starting to appreciate the layout of the entire site from a design perspective, whether the UI design is advanced, clear, and beautiful, whether the clickable content and link designs are redundant, whether there are ways to contact the blogger on the about page, how the overall site loads and displays, and what the corresponding tech stack is; how the site's traffic is, and what the view count of each article is, etc.

For example, the open-source xlog by diygod, see https://diygod.cc.

picture 7

Similarly, at work, because I was tinkering with my blog, I began to consider what technologies to use to meet my needs at a low cost. I started to pay attention to some operational technologies at work, such as Nginx configuration, Docker deployment, DNS resolution, and CDN acceleration. From the previous standard of just making it work, I gradually moved to looking at how to optimize it.

So, I expanded this concept into the Basket Theory (just making it up, haha): In life, when we go out, we should take a few more baskets to hold things, like useful tools such as hammers. The more we can hold, the more we can discover the nails in life.

picture 8

I learn, haha.

The Necessity of Saving Money on Infrastructure#

Initially, I thought it would be fine to use free deployment platforms for the blog, so I didn't consider other performance optimization measures. However, after the usage scenarios increased recently, I found that to optimize, it really costs money everywhere, haha: OSS costs money, CDN costs money, cloud servers cost money, bandwidth costs money. Although I used to apply for a budget for work, the experience is different when that budget is actually taken from your own pocket, haha.

I still remember when I was working at Byte, during the development of the coupon style that pops up in the Douyin video stream, a colleague suggested during the code review that I replace the PNG used for the dividing line with SVG.

picture 9

Although I changed it at the time, my youthful arrogance made me think, isn't the line on the coupon background just a few KB with PNG? Why change it to a large SVG? It feels unnecessary, and even if all users see it, it wouldn't consume much bandwidth. But later I realized this is a mindset; if the size difference is significant, with the user base now at eight hundred million, the consumption of bandwidth is astronomical. If it can be avoided, why not change it, haha?

Architecture Adjustment#

With gains, there are certainly costs, such as some pitfalls I've encountered 👀.

Although the work done before the research was quite comprehensive, there are still some issues in long-term use, such as:

  • The CD deployment process to Fly.io is too time-consuming.
  • Many useful features have not yet been expanded.
  • If there are too many resources, the access speed significantly decreases.

To solve the above problems, I made some adjustments to the previous simple architecture, and I will discuss each point below 👀.

The bottom line is: you still need to tinker, still need to understand technology, still need to debug, and still need to maintain it🤣.

Deployment Logic Optimization#

The original deployment logic was Astro + Github CD + Fly.io.

The tech stack of the blog itself hasn't changed; Astro's updates and maintenance are very frequent, and the community is quite active. The only complaint is that Astro updates too quickly, and some simple common component ecosystems are still quite lacking, such as image previews, automatic generation of markdown menus, etc., which still need to be developed by oneself 👀.

The first problem encountered was that the deployment time on Github was particularly long. Upon closer inspection, the problem lies with Fly.io, where the execution of the deployment process takes too long.

picture 10

Fly.io's remote runner has poor performance, and when encountering Astro plugins that run image compression, it becomes very slow. Additionally, the entire folder needs to be packaged into a Docker image and sent to the remote server, which is unnecessarily convoluted. I realized that this design was initially to utilize Fly.io's domestic access features, haha.

However, fortunately, I registered my domain recently, so I can use domestic OSS services. I suddenly realized that I could just build it directly and throw it on OSS; there's no need to make it so complicated🤣.

picture 11

Now, after the overall optimization, a deployment only takes two minutes (running locally; reasons will be discussed later 👀).

Useful Feature Expansion#

Although the blog prioritizes article quality over user experience, as evidenced by Hacker News, I also feel that this relationship holds true.

picture 12

However, this doesn't conflict; when the quality of the articles cannot be improved in the short term, enhancing user experience is also a good choice, haha. A better user experience leads to higher interaction rates, which boosts motivation to write, and can be considered a form of optimization, haha.

Traffic Volume#

For the traffic volume statistics solution, I initially thought of using the free functions provided by MongoDB. It actually worked, but the problem was that the server is located abroad, and every time I load viewCount, it takes about 10 seconds, which is indeed not a good user experience.

picture 13

The current solution is to use N8N's workflow to provide a webhook. The page initializes by calling the webhook, executing logic to store the content in PostgreSQL. I will elaborate on the specifics in my next article, haha; there's a bit of a twist in it.

picture 14

Support for Comments#

Here, I want to give a thumbs up to reorx. I saw his blog on Jike, and while reading, I found that he researched many technical implementation solutions and ultimately chose remark42 as the solution. See the original article.

Adding comments to a blog is indeed a challenging problem. If you want user experience, you can't use it domestically; if you want it to be usable domestically, the user experience is poor, which is a typical dilemma.

picture 15

Fortunately, the open-source commenting solution remark42 has solved this problem. Currently, I have deployed the comment server on my cloud server, and it remains quite stable. I haven't encountered any issues after using it for a while, so feel free to leave a comment at the end of the article to test it out, haha.

Slow Image Resource Loading Speed#

I first realized this problem after I published the Final Chapter of Attack on Titan. Once there are many images, the free bandwidth provided by Fly.io is definitely insufficient, and since I uploaded the original images, the loading speed is indeed slow, haha.

picture 16

But coincidentally, the tools in the basket connected. After moving the deployment to OSS, I added a layer of CDN on top, which solved the problem smoothly.

Here, I chose Qiniu Cloud's OSS + CDN service. One word to describe why is: cheap. I registered with a school edu email, allowing me to use 40G of OSS for free for a year, so I took advantage of that.

However, after using it, I found that the only downside of expensive services is that they are expensive, and the only advantage of cheap services is that they are cheap. Currently, uploading is quite cumbersome, and the caching strategy of qshell has issues, such as failed files not supporting retries, etc.

Moreover, running OSS uploads in Github actions is very slow because the runner is abroad... So the current logic is still to run the deployment locally, and after publishing, I have to handle it manually, which is a bit cumbersome. I will optimize this later.

Currently, the caching strategy is to not cache HTML, but the homepage is cached, not for performance reasons, but because it can't be bypassed 🤣.

As mentioned earlier, resources have been moved to domestic OSS, which relatively slows down access from abroad. Here, I directly opened a global CDN, and with low traffic, the price is completely acceptable. If willing to tinker, one could consider DNS partitioning to Vercel to use Vercel's CDN, which should speed things up significantly. However, considering the lack of foreign traffic, I will leave it at that for now 👀.

picture 17

Blog Summary#

Looking back at last year, I still wrote a few articles, although not many related to technology. Next time... next time for sure...

picture 2

The Most Viewed Article#

This article I wrote last year has reached 1K views, mainly driven by traffic from Jike. It seems that in 2022, blogs are still a hot topic, haha.

In 2022, I Finally Wrote Another Blog Site

picture 18

Conclusion#

When I first started writing this article, I just wanted to simply record how I upgraded the tech stack of my blog. Later, I thought, hey, this just happens to be the one-year anniversary of my blog, so why not summarize it? Then I found myself writing more and more.

So many times, we have a strong output ability and desire; we just need that one opportunity to think and organize our thoughts. Whether it's keeping a diary or writing a blog, it's a great form, and the key is to write 👀.

Now that you've read this far, do you want to build a site? If you do, we can chat, haha. If you're interested, you can find me through Discord on the about page for a casual chat.

In the next update, inspired by Zeabur, I'll share some small projects I've been tinkering with 👀. Interested friends can subscribe via RSS, haha 👀.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.