Computational Mobility in JavaScript

The aim of this project is to build and evaluate a JavaScript framework that would facilitate the migration of both code and execution state in a distributed computational environment. The framework targets multiple nodeJS instances, which can operate across both  multicore and distributed systems. The said framework seeks to streamline the implementation of distributing an existing system, by allowing the dynamic migration of JavaScript functions across nodeJS instances as they execute. The framework also features a remote-execution facility, allowing the migration of both code  and  execution state across nodeJS instances. This facility paved the way for the construction of an in-built, load-balancing mechanism.

Figure 1. Speed-up of the 7680 x 4320 Mandelbrot fractal

While JavaScript executing within a single nodeJS instance only harnesses a singular core [1], the ability of the framework to shift computation between nodeJS instances in a distributed multiprocessor environment provides an opportunity to exploit the inherent parallelism that is available. In order to demonstrate the effectiveness of the framework in harnessing resources for parallel computation, two task-farming case studies were written using the framework. The first case study involved a Mandelbrot set solver [3] that performs iterative calculations on the complex plane in order to generate an image representation, and which represents a highly unbalanced computational workload. The second case study involved a synthetic benchmark representing a highly balanced computational workload, for comparative purposes.

Both of these scenarios were deployed on an octa- core computer, which was set to run a nodeJS instance on every core. Results were taken over a broad range covering both the problem size and task granularity. Speed-up and efficiency-performance metrics were derived to provide concrete evidence that the framework functions as intended.

An analysis of the results concluded that the observed speed-up was bound by the problem size: small images were not worth splitting up for distributed computation. On the other hand, large images did not encounter this limit, and therefore resulted in higher degrees of speed-up. The outcomes are comparable to Gustafson’s predictions for parallel computing [2]. Finer-task granularity was observed to aid the  speed-up  and  efficiency metrics by exploiting the load-balancing characteristics of the system.

Figure 2. Result from computation of the Mandelbrot fractal


[1] K. Ghadyani. The reality of JavaScript performance, Mar 2019.

[2] J. L. Gustafson. Gustafson’s Law, pages 819–825. Springer US, Boston, MA, 2011.

[3] B. Mandelbrot, P. Jones, C. Evertsz, and M. Gutzwiller. Fractals and Chaos: The Mandelbrot Set and Beyond. Selecta (Springer). Springer, 2004.

Student: Neil Borg
Course: B.Sc. IT (Hons.) Computing Science
Supervisor: Dr. Kevin Vella