Cesar Valdez

Recent Posts

Profiling NodeJS applications with Linux Performance Tools

Using Linux Perf Tools

The Performance Analysis Tool for Linux (perfis a powerful tool to profile applications. It works by using a mix of hardware counters (is fast) and software counters, all provided by the Linux Performance Counter (LPC) subsystem that takes charge of the complex task of wrapping the CPU counters for the different type of CPUs. So you can have access to a very efficient way to get information of running processes through their C API or a convenient command in this case (perf).

This command gives you access to a great variety of system and process level events but in this entry, I will use it to investigate CPU bounded issues.  

Continue reading “Profiling NodeJS applications with Linux Performance Tools”

Share

Why should I use Node.js: The Non-blocking Event I/O Framework?

Objective

Some days ago, I was having an argument with a few Java developers about Node.js, they asked questions like  “why should I use that?” or “what’s the benefit?”, I told them by memory that Node.js is an event driven I/O, and thanks to that you will end up writing very efficient server-side applications. They come back saying that they can get the same effect using threads.

Thing is I wasn’t fully prepared to explain the difference, I had a notion of what the epoll system call in GNU/Linux is, but I didn’t have a full map in my mind. The goal of this document is to explain how Node.js Event Driven works and why this paradigm and non-blocking I/O is so important if you want to make a efficient use of your resources (Disk, Network, etc).

Anatomy of a browser request

When you are in your browser and you navigate to a site, your browser open a transaction sending a message to the server asking for some resource usually an html file, and the server execute some business logic and then respond sending this page back to the client.

To make this happen using your favorite language you need a operative system with Socket API support in POSIX compliant OS or Winsock if you run in Windows, your server code no matter in what language will end up making system calls through this library.

Continue reading “Why should I use Node.js: The Non-blocking Event I/O Framework?”

Share

Node.js – Harnessing the power of Java (for PDF generation and more)

At Red Hat, we all love playing with new technologies, and sometimes we find gaps that haven’t yet been filled. I want to take a few minutes to share a personal project I’ve been working on in my spare time. It is a native C++11 add-on that allows you to run a JVM in Node.js, giving access to the mature Java ecosystem of libraries and frameworks.

Motivation

I just wanted some mature PDF library in Node.js, like iText, PDFBox . Those libraries are very mature, for example it took PDFBox 3 years to get to version 2.0 from version 1.8, so I realized that it would be easier to look for a way to use those existing Java libraries, rather than reproduce the effort in Node.js.

Continue reading “Node.js – Harnessing the power of Java (for PDF generation and more)”

Share