Book Image

JavaScript at Scale

By : Adam Boduch
Book Image

JavaScript at Scale

By: Adam Boduch

Overview of this book

Have you ever come up against an application that felt like it was built on sand? Maybe you've been tasked with creating an application that needs to last longer than a year before a complete re-write? If so, JavaScript at Scale is your missing documentation for maintaining scalable architectures. There's no prerequisite framework knowledge required for this book, however, most concepts presented throughout are adaptations of components found in frameworks such as Backbone, AngularJS, or Ember. All code examples are presented using ECMAScript 6 syntax, to make sure your applications are ready for next generation browsers.
Table of Contents (12 chapters)
11
Index

Communication overhead


One advantage of directly invoking a method on a component is that there's very little overhead involved. When all inter-component communication is brokered through an event triggering mechanism, there's no way to escape at least a little overhead. In fact, overhead associated with this indirection is hardly noticeable; it's other overhead factors that can cause scalability issues.

In this section we'll look at event triggering frequency, callback execution, and callback complexity. Each of these has the potential to degrade the performance of our software to the point where it is unusable.

Event frequency

When our software has only a handful of components, there's a fundamental limit on the frequency of events. Where event frequency can quickly turn into a problem is when there are lots of components, some of which trigger events in response to events. This means that if the user is doing something quickly and efficiently, or if there are several Ajax responses arriving...