Tech Articles
Collated from various sources. Full copyright remains with original authors.

SSH is one of the most important tools in Linux & DevOps.
But most engineers only use: ssh user@host
without understanding what actually happens underneath.
In this series: 🔐 How SSH creates a secure encrypted tunnel 🧠 How authentication & key exchange work ⚙️ Important SSH command options explained 🛡️ Security best practices for production servers
Topics covered: • SSH workflow • Public/private key authentication • Encryption & integrity • Host verification • Port forwarding • Debugging flags • Secure SSH practices
💡 Pro Tip: Always prefer key-based authentication over passwords.

1. 𝐎(1) – 𝐂𝐨𝐧𝐬𝐭𝐚𝐧𝐭 𝐭𝐢𝐦𝐞 - The runtime doesn't change regardless of the input size. - Example: Accessing an element in an array by its index.
2. 𝐎(𝐥𝐨𝐠 𝐧) – 𝐋𝐨𝐠𝐚𝐫𝐢𝐭𝐡𝐦𝐢𝐜 𝐭𝐢𝐦𝐞 - The runtime grows slowly as the input size increases. Typically seen in algorithms that divide the problem in half with each step. - Example: Binary search in a sorted array.
3. 𝐎(𝐧) – 𝐋𝐢𝐧𝐞𝐚𝐫 𝐭𝐢𝐦𝐞 - The runtime grows linearly with the input size. - Example: Finding an element in an array by iterating through each element.
4. 𝐎(𝐧 𝐥𝐨𝐠 𝐧) – 𝐋𝐢𝐧𝐞𝐚𝐫𝐢𝐭𝐡𝐦𝐢𝐜 𝐭𝐢𝐦𝐞 - The runtime grows slightly faster than linear time. It involves a logarithmic number of operations for each element in the input. - Example: Sorting an array using quick sort or merge sort.
5. 𝐎(𝐧^2) – 𝐐𝐮𝐚𝐝𝐫𝐚𝐭𝐢𝐜 𝐭𝐢𝐦𝐞 - The runtime grows proportionally to the square of the input size. - Example: Bubble sort algorithm which compares and potentially swaps every pair of elements.
6. 𝐎(2^𝐧) – 𝐄𝐱𝐩𝐨𝐧𝐞𝐧𝐭𝐢𝐚𝐥 𝐭𝐢𝐦𝐞 - The runtime doubles with each addition to the input. These algorithms become impractical for larger input sizes. - Example: Generating all subsets of a set.
7. 𝐎(𝐧!) – 𝐅𝐚𝐜𝐭𝐨𝐫𝐢𝐚𝐥 𝐭𝐢𝐦𝐞 - Runtime is proportional to the factorial of the input size. - Example: Generating all permutations of a set.
1. 𝐂𝐚𝐜𝐡𝐢𝐧𝐠 The most common use case. Your app checks Redis before hitting the database. If the key exists, return it instantly. If not, query the DB, store the result in Redis, and serve it.
2. 𝐒𝐞𝐬𝐬𝐢𝐨𝐧 𝐒𝐭𝐨𝐫𝐞 When a user logs in, store their session data (user ID, roles, preferences) in Redis. Every subsequent request just looks up the session key.
3. 𝐑𝐚𝐭𝐞 𝐋𝐢𝐦𝐢𝐭𝐢𝐧𝐠 Redis makes rate limiting trivial. Use INCR to increment a request counter and EXPIRE to reset it after a fixed window. If the count exceeds the limit, throttle or block the request.
4. 𝐋𝐞𝐚𝐝𝐞𝐫𝐛𝐨𝐚𝐫𝐝𝐬 Redis Sorted Sets keep users ranked by score in real time. You can update scores, fetch the top N users, and find a user’s rank efficiently in O(log N) operations.
5. 𝐏𝐮𝐛/𝐒𝐮𝐛 𝐌𝐞𝐬𝐬𝐚𝐠𝐢𝐧𝐠 Publishers send messages to a channel, and subscribers receive them instantly. Great for chat, live notifications, and dashboards. Trade-off: messages are fire-and-forget.
6. 𝐑𝐞𝐚𝐥-𝐓𝐢𝐦𝐞 𝐀𝐧𝐚𝐥𝐲𝐭𝐢𝐜𝐬 Use counters and HyperLogLog to track clicks, views, searches, unique visitors, and active users with very low memory usage.
7. 𝐃𝐢𝐬𝐭𝐫𝐢𝐛𝐮𝐭𝐞𝐝 𝐋𝐨𝐜𝐤𝐢𝐧𝐠 Redis SETNX (SET if Not eXists) lets you acquire a lock atomically. Set it with a TTL so locks auto-release if a process crashes. For stronger guarantees, use the Redlock algorithm.
8. 𝐆𝐞𝐨𝐬𝐩𝐚𝐭𝐢𝐚𝐥 𝐐𝐮𝐞𝐫𝐢𝐞𝐬 Redis GEO commands let you store coordinates and query nearby locations, such as restaurants within 5 km or drivers near a user. It uses sorted sets with geohash encoding under the hood.
9. 𝐌𝐞𝐬𝐬𝐚𝐠𝐞 𝐐𝐮𝐞𝐮𝐞 Redis Lists with LPUSH and BRPOP can act as a lightweight queue for simple background jobs. For more advanced use cases, Redis Streams are a better fit.
10. 𝐑𝐞𝐚𝐥-𝐓𝐢𝐦𝐞 𝐍𝐨𝐭𝐢𝐟𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬 Redis Streams provide an append-only log with consumer groups. Keyspace Notifications let you subscribe to changes on specific keys. Useful for notifications, activity feeds, background processing, and real-time pipelines.