Clicks For Ticks#306

What’s the difference between operational and programmer errors?

— Operational errors, which are anticipatable, unavoidable errors, even in correct programs (e.g., failing to connect to a server), and programmer errors, which are bugs in the program. In general, using throw and expecting a caller to use try/catch is pretty rare expect for JSON.parse

What is ‘event-driven’ programming?

— In computer programming, event-driven programming is a programming paradigm in which the flow of the program is determined by events such as user actions (mouse clicks, key presses), sensor outputs, or messages from other programs/threads. Event-driven programming is the dominant paradigm used in graphical user interfaces and other applications (

What are ‘worker processes’?

— Worker processes provide the execution environment for all web sites and applications configured in IIS (Internet Information Services). Valuable information such as CPU utilization and memory footprint can be obtained from the API to help monitor the health of worker processes and the web server. The endpoint lists all the worker processes that are currently running.

GET

{
"name": "w3wp",
"id": "{worker-process-id}",
"status": "running",
"process_id": "45076",
"process_guid": "63e9cb86-592d-4080-9132-5a9bec85d7c3",
"start_time": "2017-03-08T09:42:34.9696447-08:00",
"working_set": "43098112",
"peak_working_set": "43098112",
"private_memory_size": "118493184",
"virtual_memory_size": "2215549431808",
"peak_virtual_memory_size": "2215550480384",
"total_processor_time": "00:00:00.2812500",
"application_pool": {
"name": "DefaultAppPool",
"id": "{app-pool-id}",
"status": "started"
},
"_links": {
"request_monitor": {
"href": "/api/webserver/http-request-monitor/requests?wp.id={worker-process-id}"
}
}
}

Describe how Node.js can be made more scalable.

Asynchronous processing

— If you find yourself asking why node.js application is scalable?, one of the major reasons is asynchronous processing. The main design principle which makes apps made in Node scalable is processing requests asynchronously. Whenever there is any background activity than needs to be handled for a request, Node delegates the required work e.g. File I/O or network I/O and goes on to handle another request, providing non-blocking I/O. Once the work is done, Node passes the processed data to the client.
Single threading in handling requests

— Almost all other platforms create new threads for each request. This can reduce performance and cause scalability issues. This is due to factors such as thread initialization and termination overhead. Node differs from other platform such as PHP, J2EE and .NET in that a single thread handles client requests.

— For any client request, Node listens to requests, hands over work to worker threads and is ready to accept new requests. Once the worker threads are done processing, the worker threads return their results to the main thread. The results can be sent to the request and processed further. This mean there is no context switching and makes it great for applications that are highly concurrent.

The Node javascript engine

— Based on Google Chrome’s V8 javascript engine, this is the third answer to the question why node.js application is scalable? There are multiple optimizations included in engine, making it extremely fast. The engine is well-engineered since is originates from Google and being open-source, it is continuously being improved.

Explain global installation of dependencies.

— Install the dependencies in the local node_modules folder. In global mode (ie, with -g or — global appended to the command), it installs the current package context (ie, the current working directory) as a global package. By default, npm install will install all modules listed as dependencies in package.

  • Global installation of dependencies is stored in /npm directory. While local installation of dependencies stores in the local mode. Here local mode refers to the package installation in node_modules directory lying in the folder where Node application is present.
  • Globally deployed packages cannot be imported using require() in Node application directly. On the other hand, locally deployed packages are accessible via require().
  • To install a Node project globally -g flag is used.

Explain RESTful Web Service.

— RESTful Web Services are basically REST Architecture based Web Services. In REST Architecture everything is a resource. RESTful web services are light weight, highly scalable and maintainable and are very commonly used to create APIs for web-based applications.

Austin Coding Academy

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store