Thursday 7 February 2019

Node.js Eventloop & Worker Pool

https://www.youtube.com/watch?v=PNa9OMajw9w

https://www.youtube.com/watch?v=P9csgxBgaZ8

https://www.youtube.com/watch?v=zphcsoSJMvM

https://nodejs.org/en/docs/guides/dont-block-the-event-loop/

https://medium.com/the-node-js-collection/what-you-should-know-to-really-understand-the-node-js-event-loop-and-its-metrics-c4907b19da4c

Worker Pool

Worker Pool: 4 threads by default.

These are the Node module APIs that make use of the Worker Pool:
  1. I/O-intensive
    1. DNS: dns.lookup(), dns.lookupService().
    2. File System: All file system APIs except fs.FSWatcher() and those that are explicitly synchronous use libuv's threadpool.
  2. CPU-intensive
    1. Crypto: crypto.pbkdf2(), crypto.scrypt(), crypto.randomBytes(), crypto.randomFill(), crypto.generateKeyPair().
    2. Zlib: All zlib APIs except those that are explicitly synchronous use libuv's threadpool.



Sunday 20 January 2019

Micro Frontends - Websites / Custom Elements / Clientside Transclusion

Micro Frontends

https://micro-frontends.org/

Example Code using Custom Elements / CustomEvent
Example using Skeleton Screen to eliminate page reflow. Also see

Micro­service Websites

https://gustafnk.github.io/microservice-websites/

Clientside transclusion for dynamic content (non-SEO-relevant) using h-include / include-fragment / hinclude.

Some salient point from Manifesto:

Heterogenous system (Evolvability)

  • Allowing for diversity of technology (including different versions of software) is critical for evolvability
  • The architecture itself should not be a limit for diversity of technology. Instead, the limit should other organisational factors, like being able to quite easily move between teams, etc

No shared libraries or frameworks in the client

  • …because of coupling between teams, Heterogenous system, and Mobile performance
  • Use a common base of JS polyfills and CSS resets. This should be regarded as infrastructure. Possibly have a small set of typography CSS rules as well.

Teams are responsible for their assembled pages

  • Use a performance budget
  • If a fragment is not good (operational, performance, etc), either it can no longer be used or it must immediately be fixed
  • It’s ok for a page to depend on a JS library, as long as the page is within budget and is following agreed policies around accessibility, etc
  • It’s not ok for a fragment to depend on a JS library

Self-Contained Systems

http://scs-architecture.org/