Late in 2016, I began development on a lightweight, isomorphic WebSocket library for Node.js called ws-wrapper . Today, this library is stable and has been successfully used in many production apps. Why? What about socket.io ? In my opinion, socket.io and its dependencies are way too heavy . Now that the year is 2018, this couldn't be more true. Modern browsers have native WebSocket support meaning that all of the transports built into the socket.io project are just dead weight. On the other hand, ws-wrapper and its dependencies weigh about 3 KB when minified and gzipped. Similarly, ws-wrapper consists of about 500 lines of code; whereas, socket.io consists of thousands of lines of code. As Dijkstra once famously said: "Simplicity is prerequisite for reliability." ws-wrapper also provides a few more features out of the box. The API exposes a two-way, Promise-based request/response interface. That is, clients can request data from servers just as easily as se
This blog post will cover the varying levels of data caching and data persistence provided by various operating systems and database systems. Cache - A device placed in front of another storage device that is used for temporary storage of data. The use of a hardware cache is often transparent to the end user and is generally smaller, faster, and less persistent than the backed storage device. Rather than reading/writing from/to a slower storage device (i.e. a hard disk), we read/write from/to the cache (i.e. RAM, NVRAM, etc.). Reading from a cache is simple. If the datum we requested is in the cache, we simply read it from the cache. If not, we need to retrieve the datum from the storage device and place it into the cache (often a much slower operation). There are different policies when we write to the cache, though... Write-Through Cache Policy - When using this policy, writing over the cache also writes over the data on the backed storage device... synchronously and si