Interview with Ryan Dahl, the creator of Node.js

Published on June 04, 2018

Interview with Ryan Dahl, the creator of Node.js

Original author: Pramod HS
  • Transfer
Ryan dahlRyan Dahl (Ryan Dahl) in 2009 introduced Node.js, a few years later retired, and last week he made a noise of a new project: deno - A secure TypeScript runtime on V8 ( GitHub , unpacking ).

It's about time to recall the interview that Ryan gave to the Mapping The Journey podcast in August 2017, about himself, his career, about Node.js, and why he stopped doing it, what he is working on now (at that time).

Fragmet translation of this interview was already on Habré: Node.js Creator: “For servers, I can’t imagine another language other than Go” . This post publishes a full translation.

Ryan Dahl is an engineer at Google Brain and the creator of Node.js, a JavaScript runtime environment based on the Chrome V8 engine. Ryan is currently engaged in deep learning research. He mainly works on image transformation - colorization and super resolution. He participated in the development of several Open Source projects, including HTTP Parser and libuv.

Pramod: Hello everyone. Welcome to the Mapping the Journey. When it comes to Node.js, everyone’s name is Ryan Dahl. He showed that we are handling the input / output incorrectly, and taught us how to design using the pure async model. Our guest today is Ryan Dahl, a hacker, a talented programmer and the creator of Node. Ryan, I am very glad to meet you, it is a great honor. Welcome!

Ryan: Hi! I am also glad to meet you.

P .: Ryan, you are best known as the creator of Node. Tell me, what did you do before you got into technology?

R: As a child, I lived in San Diego. When I was 6 years old, my mother bought me an Apple 2C, so I had access to a computer quite early. By the way, I am now 36. So I grew up just in time for the development of the Internet. I first studied at a local college, and after that I entered the University of California at San Diego to study mathematics. Then I entered the magistracy in mathematics at the University of Rochester. Yes, There I studied algebraic topology - a rather abstract discipline that seemed very beautiful to me. But after a while, I got bored, because I thought that she had no real-life applications. After graduating, I decided to get a Ph.D., but I realized that I didn’t want to devote the rest of my life to mathematics, and quit the program. I bought a one-way ticket to South America and spent a year in the “hungry student” mode. And then I started making websites with one guy, Eric. So began my career as a developer. I made a Ruby on Rails site for a snowboard company.

P .: Great! Probably, this is an interesting experience - to quit the Ph.D. program, go to South America and become a web developer.

R .: Sure. You just get used to working with abstract tasks after graduate school, and website creation is a very specific process. But I tried to turn it all into some kind of beautiful mathematical theory, like the ones I studied in the magistracy. I guess I really liked the fact that Ruby allows you to more clearly express thoughts during development. This interested me and prompted some thoughts. I think it's just in Rails. The Model-View-Controller scheme was not new then, but it seems to me that it became popular thanks to Rails. I liked this combination exactly.

P .: Yes, web development is an interesting activity, and Ruby is a great tool. After that, you were a freelance developer in Germany. One of your projects was Node. You continued to work on it for another 6-8 months, right?

R: That's it. After South America, I moved with a girl to Germany - she is German, and she had to return to the university. I started going to Ruby conferences where people discussed this new Model-View-Controller paradigm. There I met a guy named Chris Neukirchen. He created Rack - a project that, in fact, was a simplified abstraction of a web server. Rack turned the web server into an interface with a single function where it was possible to make requests and receive responses. Then I worked with the Nginx module in a freelance project for the Engineyard. I recall that in Nginx everything works asynchronously, so when you build a module for it, you need to avoid locks. I got acquainted with the Rack project of Chris Neukirchen just when I was working with non-blocking I / O on the Nginx web server. I think that's why I had an idea to combine these two things.

P .: So, on the basis of Rack and Nginx, you had an idea to develop a framework that would execute Javascript code from the server side and significantly increase performance. How did you decide to spend the next 6 months behind this case?

R .: These two elements - Rack and Nginx with its asynchrony - together simplified the web server interface. In December 2008, Chrome was released. And with it - JavaScript engine V8. More precisely, not the engine itself, but the runtime environment where JIT compilation occurs. In general, with the release of V8, I began to understand it. The V8 looked interesting, neat, and worked fast. And suddenly it dawned on me. JavaScript is single-threaded, and everyone is already writing non-blocking algorithms on it. I mean, everyone already makes AJAX requests in the browser that are non-blocking anyway. I thought: excellent, JavaScript plus asynchronous I / O and a bit of functionality for the HTTP server is what you need. And I was so inspired by the idea that I worked on it for the next 4 years without a break.

P .: Yes, JavaScript and asynchronous I / O worked perfectly. I think the developers were just waiting for such a framework. And I ask out of curiosity: when did you develop a Node, did you have some kind of mentor, or did you do it yourself?

R: In general, I did everything myself. A few of my friends are programmers, and they gave some advice, but I started working alone in my room. Then I moved to San Francisco, and at work at Joyent I met many truly professional programmers. Already there, many gave advice and suggested ideas for Node.

P .: Clear. Please tell us about the Node development process. Of course, a lot of time has passed since 2009 ...

R: For me, the best moments in life are when I plunge into something with my head, when I believe in some idea. And when I have time to work hard on it. Node was an idea that needed to be implemented, and if it were not for me, someone else would have taken it. It just so happened that I had little work and enough free time. I could devote Node a few months - just in that time you can release the initial version. And it was great and fun.

P .: Class, you did a great job. At the core of Node is the pure async programming model. Do you think this idea worked well?

R .: An interesting question. A few years have passed, and I myself have not worked on Node somewhere from 2012-2013. Of course, Node has grown a lot during this time. When he first came out, I read a lot of lectures and tried to explain that maybe we did everything wrong, and non-blocking I / O would help solve many development problems. Or we could forget about threads altogether and get by with only process abstractions and serialization. But at the same time in the framework of one process would be processed many requests, and so we would achieve asynchrony. At that time, I sincerely believed in this idea, but over the past couple of years I realized that this was far from the only possibility. Especially after Go. In my opinion, Go appeared even earlier, but I first heard about it in 2012. Then he already had a good runtime and high-quality green threads, and with all this it was easy to use abstractions. It was like blocking I / O, but as far as I understand, the interface between Go and the operating system through green threads is actually non-blocking.

However, all this was available to the user as a blocking interface, and, in my opinion, such a model has advantages. As a rule, blocking algorithms make it easier to figure out what is going on. When there is some sequence of actions, you can follow it: execute A, wait for an answer, or maybe catch an error. Then execute B and also get an answer or an error. In Node, everything is more complicated, because you have to jump to another function call.

P .: I also really like the Go programming model. Using Goroutines is a pleasure. Now my team is writing a distributed application on Go.

R: Yes, for some types of Go applications are best suited - for example, when building a server. I can not imagine how to work with something else. Although, I think, the non-blocking paradigm worked great for Javascript, in which there are no threads. In addition, Javascript now has the async keyword and can work with asynchronous functions, so you no longer have to rush between anonymous functions and understand the wilds of callbacks. In the new versions of Javascript work has become easier. However, I believe that Node is not the best option for a large-scale web server. For this, I myself would choose Go. Honestly, that's why I stopped working on Node. I just realized that this is not an ideal server development system.

Oddly enough, it seems to me that Node really brilliantly showed itself just on the client side. It allows you to slyly use scripts when creating websites. For example, Browserify packs client-side Javascript. This allows the server to handle JavaScript from the client. Another example is small development servers, or even production servers that handle live traffic. Node can be very useful and convenient for some things. But if you are raising a huge distributed DNS server, I would not advise choosing Node.

P .: Developers around the world will be useful to think about it. For any business, it is important to choose the right tool, so you have a completely objective attitude to Node. You first introduced Node.js at JsConf 2009 Berlin. Perhaps you were surprised that he so quickly achieved success?

R .: Of course. In general, I have not been surprised for four whole years. Node was developing at an incredible pace and was very popular with the community.

P .: After that, you joined Joyant in San Francisco and worked on Node on an ongoing basis, right? Tell me about your experience there. The developers were very pleased, and you were in the middle of it.

R: Yes, it was one of the highlights of my life. I really was in the very center of events, I went to various conferences. Once I even visited Japan, and people asked me to take pictures with me ... I even felt somehow uncomfortable. When I commented on something on the net, it feels like a hundred people answered me right away. Then I realized that I had to carefully choose words and think about how they perceive me - it seems that they really listened to me, and this was unusual. I didn't like it all. After all, I am a programmer and just want to write code, and sometimes express an opinion without undue caution. In this regard, I was a little uncomfortable.

P .: Were you 29 or 30 years old when did you create a Node? And he has become so influential technology.

R .: Yes. But then I was rather a novice developer.

P .: Ryan, at that time there were a lot of different projects that worked with JavaScript on the server side. Node was not the only solution, but it became the most successful - what do you think, why?

R: It's true, several people tried to adapt JavaScript for server work. Now I do not even remember their names.

The fact is that in all these projects blocking I / O was used, and this was not very well combined with the way JavaScript is built, because it does not work with streams. And if you use blocking I / O, you will not be able to process requests. That is, it is necessary to process them one by one, and nothing will come of it. In addition, I added a quality HTTP module and showed how to configure an HTTP server, as well as a simple TCP server. I tried to make these things work properly and people could build websites without any problems. It is necessary to admit that to raise the web server is not an easy task, and many projects required functionality that the community had to finish building on its own. But no one built anything, because the system had nothing to use. In my opinion, for any new framework, or a product in general, you need a basic sample, which you can immediately use. This was an advantage of Node - people could just download it and immediately set up a web server.

P .: Indeed, good samples are very important, as is ease of installation and use. Many more already knew how to write code in JavaScript, so they could get down to business right away. When I first started working with Node, my knowledge of JavaScript also helped me a lot.

R: I think we used to think that switching between languages ​​is easy enough. But even if you already own some language, it’s not so easy for the new language to build a context. Many developers already know Javascript, so they are interested in using the already familiar language in the new context, with new tools. It turns out that the same language opens up wider possibilities.

P .: That's for sure. In 2012, a huge number of developers worked on Node. Why did you decide to leave and transfer the project to Isaac Shluther from Joyent?

R: I think there were two reasons for this. Then I worked on Node for 4 years, and, in general, did everything I planned. I never expected Node to become a huge API. My intention was to create a small, compact core on which people could build on their modules. I wanted to support several key features. Expansion modules were added from the very beginning, then we put in order the network libraries, HTTP, UDP, TCP, and provided access to all file systems. Then the team of five people coped with an important task - setting up all of this for Windows. We wanted to use Windows abstractions — ports of completion — for asynchronous I / O. Therefore it was necessary to rewrite the root library, and this resulted in the libuv library. At some point, everything was ready, and we released Node for Windows. Then I thought: fine. I achieved my goal, and I am glad that I managed to bring everything to mind. Of course, there are still a thousand bugs that can be fixed until the end of life, but there are enough people in the team who can take care of this. I wanted to do other things. In addition, Go came out, and for me Node was no longer the only solution for server development. Well, I just did not want to be in the spotlight every time I write something in a blog.

P .: Clear. Yes, not everyone likes it. When you started working on Node, you probably had some plans. Do you think now Node has executed them?

R .: Of course, Node exceeded all my expectations. After all, now it is used by hundreds of thousands of people.

P .: Tell me, what did you decide to do when you completed this interesting stage in the development of Node?

R: After I left Joyent, I moved to New York and took a little vacation to work on my own projects. I had several of them. Instagram came out at the time, then it was original and uncomplicated. Everyone said: "Wow, it is so simple, I would have built it myself." And, of course, I thought so too. I had a social network project, I also built a build system for C ++ and another build system for HTML, which was similar to Browserify - it packaged Javascript and HTML in a clever way. In general, I had a lot of projects, but, it seems to me, not one of them really worked out. Some of them are still at the development stage, for example, my social network. Someday I will take it again. That's what I did for a while. Then I started reading and learning about convolutional neural networks and how

P .: You were also a resident in the Google Brain program. What are your impressions?

R: Yes, I recently spent a year in Mountain View. I'll be back to the past: TensorFlow came out two years ago.

At the same time in the machine learning lab, Google Brain announced a new program for residents, according to which about 20 people are invited there. I think the idea was to invite people who are not necessarily familiar with machine learning, but who understand math and programming. Those who were interested in working with these new ideas. Machine learning is constantly changing and a lot of work is being done, but now the community has finally focused on neural networks. It is believed that this is the most effective algorithm for machine learning. Therefore, there was such an idea - to gather people who are interested in working with the new TensorFlow framework, in order to possibly come to some curious conclusions. I spent a year in the lab. I basically developed models and wrote scientific papers about them. For the most part, I worked with image transformation tasks. That is, if there is any original image, you need to predict what image will be output. In my opinion, this is a very interesting task. One of the real examples is colorization. You can take a black and white image and try to predict what colors will be the result. The most interesting thing is that for this task there is a whole infinity of data for training. After all, you can completely remove the saturation from any color photo and get the original black and white image. One of the main problems in machine learning is the need for a huge amount of data, and there is plenty of data for such tasks. More recently, a lot of research on generative models has been conducted. For example, there are generative-contention networks and pixel convolution networks, who have learned to perceive real images, that is, to distinguish between real images and artificial copies that look like real ones. I wanted to use the results of these studies of generative models and an endless database for training, and apply all this to the tasks of image transformation. I researched super resolution - this is a process that allows you to increase the resolution of the original image. I also worked on the transformation task between images and completed two colorization projects. which allows you to increase the resolution of the original image. I also worked on the transformation task between images and completed two colorization projects. which allows you to increase the resolution of the original image. I also worked on the transformation task between images and completed two colorization projects.

P .: Thank you for the excellent explanation, Ryan! I also read that TensorFlow is a powerful platform for machine learning tasks. Classification of images, transformation - of course, I especially understand them, but I am sure that all this is very fascinating. Do you continue to work in the field of machine learning?

R: Yes, I still work at Google, but already as an engineer, and do similar tasks. I study generative models and help researchers build systems and models of the new generation.

P .: Great! Although the generative models are almost not related to your past activities - Javascript, Node and web development ...

R: That's for sure. But still, I started with mathematics, and I have a good mathematical base. Well, I'm not one of those who agitate for some particular area. I don’t want to be a guru for either JavaScript or machine learning. I just enjoy exploring interesting features. Most of all I am inspired to invent and build something new that will benefit mankind.

P .: Clear. It is useful to know that the mathematical base helps in machine learning. In one of your last posts in Optimistic Nihilism, you wrote that in the future we will be able to simulate a brain and build a machine that will understand people and think like them. What do you think, how close are we to this goal?

R: Yes, I have to be more careful with predictions ... So just share my personal opinion: we are inconceivably far from simulating human intellect. The machine learning systems we work with are either very primitive or not at all workable. I just wrote a blog post about my residence in Google Brain, and there I listed the problems that arise when developing such models. It seems to me that those who are far from this sphere often think that it is possible to take a model, transfer data to it and everything will turn out by itself. But it is not so easy. There are many pitfalls and insufficiently investigated issues. To get even the most modest results, sometimes it takes many months of experimentation and delicate tuning. So we are still very far from imitating the human brain, but already promising technologies are emerging - for example, convolutional neural networks or the backpropagation method. And, what is encouraging, these technologies are based on a model of neural networks, which is not so much like the human brain, but to some extent inspired by knowledge about it. We also have GPUs and training methods for them, and we already know how to conduct at least partially distributed training with them. Therefore, in my opinion, the foundations for more large-scale and intelligent systems are being laid now. Personally, I am an atheist, and I don’t believe that my brain is more than chemicals and neurons. My consciousness and the consciousness of any person are somehow encoded in the interactions of these neurons. Therefore, in principle, there is no obstacle in order in order to imitate these processes, more research and development in this area are simply needed. It is too early to predict how long it will take.

P .: I see. Ryan, you have seen a lot - say, how do you think technology will develop in 20 years?

R: I follow the machine learning and the opportunities it opens up with great interest. Even before we create real AI, these technologies can find many different uses. In principle, they will be very useful in any system where you need to make reasonable assumptions. For example, you can use computer vision to sort materials at recycling centers. There are just countless areas where basic machine learning technologies would be useful. I think they will increasingly be applied in a variety of processes, and this will have a huge impact on the technology sector and on humanity as a whole.

P .: I agree, machine learning is an exciting topic. It is so interesting to observe how cars without a driver go around the Mountain View. Someday in the future it will be great to just lie back in a chair and trust the car to full control. Ryan, thank you for the excellent Node framework and for being our guest. And good luck with your future projects!

R: Thank you for the invitation, it was interesting to talk!

P .: Thank you! That's all. I was glad to have a chat with Ryan, a modest and great guy. He has already achieved a lot at the beginning of his development career and has gone an impressive way. See you in 2 weeks to get acquainted with the next story!