I spend a lot of time in front of the computer without taking breaks. It’s not that my work is particularly interesting or important, there’s a kind of inertia that makes it easy for me to sit for extended periods. Such a routine can be harmful to my eyes and may lead to other health issues like cardiovascular disease, obesity, back pain, and...
I’ve been using the built-in input method on macOS for a while, and it’s pretty good, it is fast and doesn’t have many fancy features. In my daily work, I’ve gotten used to coding and searching in English. I rarely use obscure Chinese words, nor do I need to use internet slang. However, the quality of the first line of candidate words in Chinese...
VictoriaMetrics can serve as a full-featured alternative to Prometheus (not 100% compatible). Its official selling points are Scalability, Reliability, Ease-of-Use & Cost-Efficiency. The author has previously released some golang code libraries known for their performance. As an alternative to Prometheus, it tries to solve many existing problems...
The devil is in the detail. Use Cases of Distributed Lock Distributed locks are used to avoid the following issues when shared resources are read and written simultaneously in multi-process/multi-machine scenarios: Concurrent reading and writing leads to dirty data. Concurrent reading, based on the read data/state, results in...
When I was in school, I felt that having learned enough rules, laws, and problem-solving templates, I always lacked interest in these things. Therefore, when I first started writing code and encountered the MVC pattern, I felt that MVC and the like were not good practices after trying a few times. Why should one make things so complicated when...
After scanning the basic concepts and various components of k8s, it is very large and “beautiful”. It is something that requires experience. I thought about learning k8s through practice. The concept of Serverless is very popular right now, and the current general manifestation is FaaS? This thing is very mysterious and does not have a very clear...
It’s important to take a break and get out more. I’ve been working for over two years and nobody has shared with me anything beyond technology. I was at home pondering life when my server strangely reported a high memory usage rate. There were no abnormal processes on the monitor, but the overall memory usage rate was very high. Checking on the...
The previous article has become increasingly bulky, so I’ve decided to extract it and start a new one. The so-called “pitfalls” are actually due to the incomplete documentation of etcd or the high expectations of the users.. One should understand what is different about Revision, ModRevision and Version? when using etcd. If consistency is...
EDIT(2018/06/02): I was too ignorant, I read the book for nothing.. See https://github.com/golang/go/issues/25701, and I mildly complained about Golang’s interface (Dialer.Control & ListenConfig.Control).. The rest of this article is just for reference, it’s just a draft. X Me In the previous article, I did something stupid, I...
Preface Let’s start like this… In the past, a lot of things needed to be done in the SOA framework: database, cache, message queue, service discovery and registry, service/api downgrading, circuit breaker, distributed tracing, load balance, metrics collection, logging, caller/callee white/black list, concurrency control, rate limiting, config...
Python is slow because it eats CPU, and multithreading can’t effectively utilize multi-core. However, this product not only eats CPU but also eats memory, which is very greedy. In my previous article, I mentioned a project. I never paid attention to it. This product probably loaded 70M disk files into memory in the form of dict, and the memory...
It’s quite nice to occasionally doubt life (⊙﹏⊙)b Love The advantage of Python is that it’s enjoyable to use, has high development efficiency, and its concise syntax can be said to be the reason for its enjoyability but not the reason for its high development efficiency. Nowadays, who would do daily development with Notepad or naked...
Adding an instance attribute dynamically is as simple as: obj.a = 1 or setattr(obj, 'a', 1). So easy! However, when it comes to dynamically adding methods, the problem arises. Here, a method is dynamically added to an instance: >>> class A(object): ... pass ... >>> def hello(self): ... print "hello" ... >>> a = A() >>> a.hello = hello...
Singleton Pattern Ensures that a class has only one instance, and provides a global access point to it. Let’s take a look at the Singleton pattern in tornado.IOLoop: class IOLoop(object): @staticmethod def instance(): """Returns a global `IOLoop` instance. Most applications have a single, global `IOLoop` running on...
Every now and then, there are always a few days when I feel like messing things up. This time, I reformatted the whole hard drive and reinstalled the dual system. As a result, I couldn’t play League of Legends anymore with Win10 + A card… So I had to go back to Ubuntu. While wandering online, I came across this picture, which provided strong...