DevOps Kitchen #1 - 24/7 online services on AWS EC2 spot instances

Facts

  • pricing
    • spot instance price is cheaper by 50-80% On-Demand price
    • reserved instance is 28-64% cheaper
  • How AWS will notify you that your instance will be shut down?
    • pooling type
      • instance metadata (/spot/termination-time)
      • cli describe-spot-instance request
    • event driven (!)
      • Cloudwatch Events -> instance action
  • Spot instances market changed:
    • now the main reason for termination is instance-terminated-instance-terminated-
    • price chart is more stable, but a bit higher (since April 2018)
    • billing type is one second - so no more first free hour if AWS shut down your instance

What happens when you type an URL in the browser and press enter?

dns basic

  • At the beginning browser checks cache for a DNS record.
    • first browser cache
    • second OS cache
    • then router cache
    • lastly ISP (Internet Service Provider) cache
    • if all cache’s are empty then request is sent directly to ISP
  • When browser has an IP adress, next a TCP connection is initiated
    • typically HTTP/HTTPS GET request is send and in order to establish connection a three-way handshake is made.
      • Client sends SYN packet to server, checks if a new connection could be estabilished
      • If servers has open ports, that could handle new connection, it will respond with ACKnowlened of the SYN packet. Therefore a SYN/ACK packet is sent back
      • The client (browser) receives SYN/ACK packet from server and then ACKnowlages himself to server by sending ACK packet
      • After this polite greetings connection is estabilished and data can be send to browser
  • After That browser has a content to display (HTML is most common)

Pure Functions - my introduction to functional programming

Let start with classyfing other programming paradigms:

DOM Events: Bubbling and Capturing

Bubbling means that:

SQL JOINs 101

visual cheat sheet

Another look at addEventListener

Everybody knows this classic way of handling events. We use it everyday

JavaScript Engines - 10000 Foot Overview

Nowadays JavaScript runs not only in browser but also in:

  • Server
    • Node.js
  • Mobile
    • ReactNative
    • NativeScript
  • Native Apps
    • Electron

request Animation Frame() - another look at animation

The oldschool & Classic way of animating content in using SetTimeout() or setInterval() . But those function can heavily decrease performance. Browser wants to repaint screen in approximately 60FPS (or 16.6ms). But it’s not possible when the stack is not empty. Every call to mentioned functions put a task onto a queue, which is moved to a stack after a specified time. So it might happen that if you abuse them You may block UI. Play with it by adding junk to stack - in this case, a lot of factorial recursive calls.

JavaScript closures

What, Why and How?

In JavaScript closure is a basic way to enable data privacy. We start with formal definitions:

Hello World

That’s my first post!