Posts

Single Thread Mystery - Node

Image
A Single Thread that handles multiple request ? I have been reading about threads and all the performance gain that you will have if you use multiple threads but there is Node which runs on a single thread. So i tried to investigate how node handles multiple request using a single thread. Event loop Architecture Node uses an event loop architecture. It specifically uses a non-blocking I/O event model. This means the thread of execution will not block if it is an I/O event. But what is an I/O event for Node ? Well all http requests, database queries, file manipulation [ 1 ] In my mind i picture node like these (The diagram is based on a typical process structure)  Code - program code Data - variables of the program Files - file pointers (I am not sure about if node keeps file pointers at the process level) After trying to picture this out, several questions pop in to my mind.  How will node be able to utilize a multiprocessor hardware ? Node has &qu

Threads - start using it!

Why should you use a lot of threads ? Threads can help you take advantage of multi core CPU systems. It enables your application to run parallel and concurrent tasks. It will help your application be responsive, your application processes can share hardware resources, it will be less costly ( in terms of hardware resources) than starting a new process.[1] BUT using threads brings up new programming challenges. An application is harder to test and debug when it is multi threaded. Even if applications are harder to test, we should embrace it because those core are going to multiply really fast and applications should take advantage of it. If you are a programmer you should really learn and teach yourself how to write applications using multiple threads because it is going to be required sooner or later. So what do you need to know about Threads ? In order to effectively use the underlying hardware (processor), a developer should know the underlying threading model where yo

Recommendations - Hey user, I think you might like this!

Would you likely read this ? Recommendation has been part of most online systems for quite some time now. Amazon, Target, and Netflix have recommendation algorithms that gets you to look at more items either to buy or watch. The basic premise of recommendation is to use collected historical data for a user in order to determine items or products that might be valuable to a user. Determining the recommended item is based on a strategic plan of what the goal is for recommending. It is usually for a user to purchase additional products or something that will significantly help the user. The "strategic plan" is usually something based on a business goal to push (recommend) to the user. Pushing an item for recommendation without real significance and context is not really a good plan because users will ignore such recommendations with high probability and will also alienate users (kind of like the web sites in facebook that are full of advertisements that does not really make s

ElasticSearch - Sniff ! Sniff!

Note: Below is a brief discussion of the issues i have encountered using Elasticsearch's  Client  behind a VIP. As I had written previously, I had to setup an Elasticsearch cluster. In order to take advantage of balancing the load between the nodes of the cluster. I used a DNS pointed to VIP that does a round-robin load balancing among the nodes. The reason i choose this is because I can add servers to the VIP without changing the Transport Addresses in the Elasticsearch Client java code which uses a TransportClient. Without the VIP I need a coding change and deploy to add the new Transport Address. The cluster would not be really useful if I cannot take away nodes and add nodes to the cluster as I wish without any coding change. The drawback in hiding the cluster behind the VIP is that you don't know which node the java code client is going to get in order to process a search request.  This is causing an issue in the client code.  Since I only have one Transport Addre

ElasticSearch - Preventing Split Brain With a Cluster!

Image
Elasticsearch - Brain Cluster ! After reading this about article about elastic search cluster -- Split - brain problem  I wanted to be careful about setting an elastic search cluster. I have to setup a 3 node cluster of elastic search. After reading a few articles about it, it comes down to how the cluster will be used mostly. Here are some of the questions that i asked when setting the cluster up. I hope that this can be a good starting point for anybody setting up elastic search cluster. 1. How many nodes are you going to use for the cluster ?    We only have 3 physical servers that is why i decided to use a 3 node cluster.       Here are the settings that i used          Gave the cluster a name [cluster.name: brain] - brain cluster           Gave each node a name [node.name: "brain_1"']                                                [node.name: "brain_2"']                                                 [node.name: "brain_3"'

FontAwesome 4.1.0

I had the recent task of upgrading our website typography and icons from FontAwesome 3.2.1 to FontAwesome 4.1.0. I have to scrub our source code for every tag. The good thing about our source code is that we are using less (css pre-processor) that made my life easier. The hardest part in upgrading is making sure that you are referencing the same icons The upgrade change a lot of names of the previous icons that are not really related to the previous name like icon-remove is now fa-times (I don't know the reason why) but here is a list of the names of the icons that have changed Icon name changes from 3.2.1 to 4.1.0 Upgrading to 4.1.0 gives us 71 new icons to use Here are some of the new icons i like (I added the colors) Font Awesome - Galactic Empire Font Awesome - Rebel Alliance Font Awesome - Space Shuttle Font Awesome - The Bomb Font Awesome - Recycle Font Awesome - QQ

Network Speeds: As a developer you should be mindful!

Network? What Network? In any complex enterprise application system network communications is an inevitable part of how the system will get accessed. Web applications are accessed through a complicated infrastructure of communication devices. Developers never take notice nor care about the network (most of the time) that delivers application to users, but developers should care, specially now that more applications are accessed through mobile devices. Here is a link that talks about how mobile networks might affect the performance of applications from Google IO. This talk really presents a valid point on how you can develop a strategy around your application in order to be more responsive within the constraints of mobile networks. Mobile Performance Wifi Networks! After seeing this talk I started wondering about Wifi networks. Even though mobile networks are becoming ubiquitous, the speed and performance are still not comparable to Wifi networks. Any enterprise system appl