Yunpeng's Blog

Life, coding and everything

In this post, I will discuss a few common partition techniques in distributed cache. Especially, I will elaborate on my understanding on the use of Redis Cluster.

Please understand that at the time of writing, the latest version of Redis is 4.0.10. Many articles on the same topic have a different idea from this post. This is mainly because, those articles are probably outdated. In particular, they may refer to the Redis Cluster implementation in Redis 3. Redis Cluster has been improved a lot since Redis 4.

(This article was based on part of my project report. You may want to take a look at the full report here. You may need a valid account to gain access to NUS SoC Digital Library.)

Common Partition Techniques

Here, we refer to horizontal partitioning, which is also known as data sharding. Traditionally, there are 3 approaches to achieve data partitioning, namely, server-side partitioning, cluster proxy, and client-side partitioning.

Read more »

When I planned to upgrade the CS1101S DG Website project, selection of the technical stack became a big headache. The current decision is

In this post, I would like to present the decision-making process.

What are the possible languages, frameworks?

Certainly, there are many different choices. Let’s compare them as follows. To select a backend framework, it is essentially to select a server-side programming language.

  • Java (current choice): good for scalability and maintainability, used in many enterprise applications. As a relatively old language, its robustness is no doubt.
  • PHP: also a traditional choice. However, its performance is not as good as Java (since Java is a fully compiled language, PHP is parsed into opcode and sent to Zend Engine).
  • Ruby: a dynamic-typed language, which becomes famous due to Ruby on Rails. You can write less code to achieve more functionalities. However, its performance is even worse and its development environment is also not trivial to set up.
  • Node.js: a newer technology than others. It provides a unified language for both frontend and backend development. It is fast since it leverages JavaScript event loop to create non-blocking I/O.
  • Python: clear and compact syntax that is helpful to developers. Similar to Ruby, it has potential performance issues.
Read more »

As you may already know, this blog is built using Hexo.js with theme Next. In this post, I will discuss the reasons why I select this static site generator and this theme.

Why do I select Hexo.js?

  • I want a blog website that only consists of static webpages. Thus, I cannot use any content management system (CMS) with dynamic pages, like WordPress and Drupal.
    • This provides me with more options to host it. For instance, GitHub Pages only supports static webpages.
    • Static webpages are generally faster. They do not need any server-side pre-rendering.
  • It may be a waste of time to write raw HTML, CSS & JavaScript code for every page of the blog. Much of the code can be reused. Thus, I need a framework to help me generate the static webpages.
  • I want to develop in both Windows and Linux-based environment. This means some programming languages like Ruby may be troublesome. Thus, I will not choose engines like Jekyll.
  • The body of my blog posts should not be in plain text. I need basic styling of the text. Also, I may insert code snippets to technical posts sometimes.
    • Therefore, the framework had better support Markdown and/or AsciiDoc.
    • I know how to use LaTeX. My slides for my CS1101S classes are all typed in Latex with Beamer package. However, although LaTeX is very powerful, I have to say its syntax is way too complex.
      • In fact, the Next theme also supports math equation rendering by either MathJax or Katex.

Given all the factors mentioned above, I choose Hexo.js in the end.

Read more »