Memcached is a distributed Memory caching system, it is probably the de facto standard of caching facility for high performance web applications. In short, it is a key-value store which runs entirely in the memory, so it’s extremely fast and also proven to be reliable to handle high traffic.
Steps to install on CentOS (just works!)
Run the following commands one by one in the terminal, this will install the memcached server, and the PHP “Memcahe” classes needed to be used by Continue reading “Install Memcached with PHP extensions in 5 mins (CentOS)”
Android is probably the most popular mobile operating system, a lot of programmers join the Android club to be an Android developer and turn their ideas into great apps. While some of you may not be interested in making a mobile app, but I would say you should give it a try. In this article I’ll try to convince you that you can improve your programming skills by studying the Android framework.
By simple, I don’t mean programming in Android is easy. The Google Android team has made it very easy for beginners to get started, just fire up the Eclipse IDE and load the examples and you have your first Android app. Through Android you’ll learn how to organize an app that is so simple to understand, write and deploy. You could apply this in organizing your web application. There’s a lot of good engineering practice in the Android framework. Of course, programming is never easy, if you feel that what you’re doing is easy, you maybe not making something useful!
It’s well documented
Learning Android is a joy. Continue reading “Why Learning Android could improve your programming skills”
Today I have found that there is an IP in Turkey keep trying to login to my server, and I’ve found that my current settings has no protection against this brute-force login, so I did a Google search on this and would like to share with you guys.
To check if your server is currently being attacked via ssh, use this command
> tcpdump port ssh
In CentOS, the sshd config is located at /etc/ssh/sshd_config, I have uncommented the following lines:
you can also limit root access, allow only certain IP to access the ssh etc, however I’m using dynamic IP ISP and I’m used to root ssh access, so I only use these settings.
Relying only on sshd_config is not enough, the attack host still keep sending login requests and could possibly paralyse the network traffic of linux box. I need to find a way to Continue reading “Protect your server from SSH attack”
As a Linux user/administrator, It’s important to monitor the memory usage of the system and make sure the Apps are running with enough resources. To view to memory usage of your Linux box is simple, just use the command:
But do you understand all these numbers? Sounds obvious, I have total of 496MB memory, used 271MB and 225MB is free. Sometimes I see even smaller value of “free” memory, makes me wonder what actually eat up my memory. But wait….What is “buffers”, “cached” and “-/+ buffers/cache”? You’ll notice when the buffers and cached went up, the “free” will decrease. To understand what’s going on here, you need to know how Linux works.
Leaving your memory idle is not a good idea
Firstly, it’s important to know that memory or RAM is about 500x faster than a Hard drives and the access time is measured in nano-second. You definitely want your data/program ready in the memory when you need it! So that you don’t have to wait for the hard drive. What Linux do is that it will keep portion of the files you have used before (or will use soon) in the memory, to improve the performance of the OS, this is called caching. However, those memory can still be used when necessary.
Caches are also “Free” memory
From the example above, essentially I have 372MB of memory available for applications. As the memory usage of apps increase, the OS will free up the memory for the apps. Generally you don’t want to see a lot of free memory, because that means you’re wasting the resources. You want them to be used by the OS to improve overall performance, however when you notice there’s constantly very little free and cache memory, you may consider adding more memory to the system.
- free -m
- ps_mem.py (A tool to view how much memory the apps actually used)