Back
Menu
Close

    white flag

    Thank you for submitting your inquiry, we will get in touch with you shortly!

    Full Name*
    E-mail*
    Title
    Company
    Leave your message here
    Other

    Using Node.js

    Using Node.js
    avatar

    Eugen Kashnikovich

    July 23, 2018

    If you are in the world of computer science, coding or technology, you need to know and understand Node. Node is a trending technology and a very smart technology that is being used in the development of many apps and for many websites.

    So what exactly is Node?

    Node is a basic unit that is used widely within the realm of computer science. It is an important technology that has been embraced by many real-time applications who need fast service and solutions. Netflix, PayPal, Trello and LinkedIn all use Node.js. These are pretty big sites and Node.js supports them on the server side.

    A Node is anything that has an iP address. It is a device or a data point on a network that is large. PCs, mobile phones and printers are all nodes. Node.js, which stands for Java Script, is driven by events on the server side. Node.js is suitable for pretty large apps where a lot of power is needed – or simply put – a lot of data.

    Why is Node.js so widely used?

    Node.js. has many advantages which is why it is so popular. Node.j.s is able to handle sizeable amounts of data. And it is not just size that it can handle. Node.js allows operations to be performed by the server, in a computer network of considerable size, in a client server relationship.

    Take a look:

    • Node provides the perfect server side service.
    • Node is easy to implement.
    • Node.js is efficient and reliable.
    • Node.js. is even driven and a non-booking I/O model.
    • Node.js works quickly and with huge amounts of data.

    Let’s have a look at why Node.js is a good for service side service

    • It uses few server resources.
    • It is scalable, which means it can be easily added to or removed from.
    • It is modular. You can add new logic which will not interfere with current logic.
    • It is fail safe.
    • It offers a good logging system.

    How all this can be done with Node.js

    A client makes a request to the service. This request goes via the router, also known as the Master Service. The Main Service is the center of the action. The requests come to the Master Process and the Master process, or router, sends out the info and asks for action. The Master Service validates the request and once validated, spins into action. The service request is activated and put into action. More than one activation can take place at the same time.

    Look at the diagram below.

    Pattern

    The beauty of good server side service is that no action will be taken without validation. If a validation fails, an error will be returned to the client. Also checks all the sub processes or task types, checks what data is needed and only sends the task through to the task registry if and when validation is received. This is all speedy and happens without the client knowing what is going on behind the scenes. It’s computer science at its best.

    How do Service Sub Processes work?

    A number of service sub processes will start dynamically, as needed. Node.js. will communicate in computer language, receiving the activations of logs, tasks, errors or exit codes. It will restart or disconnect or activate on action. Node.js can use fewer resources by controlling how many instances are working at the same time.

    See the below diagram.

    Memory Usage

    Resource: https://thebittheories.com/rails-vs-nodejs-the-comparison-feba9081251f

    How does Node.js provide scalability while remaining fail proof?

    It is easy to do this. Take a look below where a new instance was created and immediately logged the information. Through the error, the Master Process (router) received the errors and checked them to see if they were sub process disconnections. The task is then marked to try again and to the sub process is restarted.

    createWorker

    Complicated? Not at all. It is easy to set up, easy to code, easy to manage.

    What is the Task Registry?

    This is the storage are for all the tasks and all the data. It is an NoSQL database which means it fits an incredible amount of data and has a huge storage space. It is efficient and comfortable with all the storage and is fail-safe. When we say fail-safe (more so than just in-memory storage) remember that everything has a date and time and of course updates must be done as needed.

    What are the Service Instances?

    These are the centers where the jobs or tasks are actually done or activated. The service instances check the task registry for the incoming jobs, and this happens so quickly it is almost ongoing – every N seconds the tasks are checked. When a new task comes in, the Master Process is notified by means of a ‘unique task’ identifier. It is then marked as ‘in progress’ and is an important part of why everything is fail-safe.

    All the tasks that come in are pre-defined. They are shared between the router or Master Process, the task registry and the service instances. It is a modular design, a group of modules, that allow tasks to be added or removed. It is therefore fluid.

    white keyboard
    Want to begin a project that requires a tailored solution?
    Book a call

    Click on a star to rate it!

    Average rating 5 / 5. 1

    No votes so far! Be the first to rate this post.

    Top articles
    View all

    Related Articles

    custom-single-post__bottom-part--post-image
    custom-single-post__bottom-part--post-image
    custom-single-post__bottom-part--post-image
    custom-single-post__bottom-part--post-image
    custom-single-post__bottom-part--post-image
    custom-single-post__bottom-part--post-image