Skip to content

Latest commit

 

History

History
90 lines (64 loc) · 2.51 KB

MICROSERVICES.md

File metadata and controls

90 lines (64 loc) · 2.51 KB

Microservice

Articles

Ingress

  • An API object that manages external access to the services in a cluster, typically HTTP.
  • Ingress may provide load balancing, SSL termination and name-based virtual hosting.
  • Requires ingress controller
  • Typically:
    • Cluster IP
    • NodePort
    • LoadBalancer

Service discovery

  • Solutions
    • Consul
    • Etcd
    • Apache Zookeeper
  • Work
    • Register service / Find service
    • Key/Value storage for dynamic configuration
    • Health Check

Prometheus

  • Open source monitoring and alerting toolkit built at SoundCloud

  • Time series multidimensional data

  • Metrics (request count)

  • Logging - collecting log reports deliberately produced by app

  • Tracing - watching program flow (noisier), optimization

  • Monitoring - overall state of the system, what stopped working...

ELK

  • Elastic Search - database optimized for fast search, document model
  • Logstash - Server side data processing pipeline - transformation
  • Kibana - client for Elastic Search and visualization tool

Jaeger

  • Open source, end-to-end distributed tracing
  • Distributed transaction monitoring
  • Performance and latency optimization

InfluxDB / Telegraf

  • Purpose built time series database Diagram

Go Garbage Collector

  • Objects are stored on heap and stack
  • Garbage collector operates on heap
  • Stack is LIFO, Go prefers stack (oposed to java)
  • Type Mark & Sweep
  • Stop the world - turns on white barrier on all goroutines
  • 3 Color algorithm:
    • On start all objects are white except root Grey objects
    • Scans stacks, globals & heap pointers to understand what is in use and marks them grey
    • Grey objects are set to be marked black, which indicates they are in use
    • Then it deletes white objects
  • It will run again when memory is low

Indexes

  • B-tree, GIST (geo), GIN (inverted index typical for arrays)

Performance of query

  • Explain Analyze
  • Execution plan
    • Shows how tables will be scanned (sequential, using index)
    • What join algorithms will be used to bring data from each table
    • Estimating costs

Algorithm estimation

  • for - O(N)
  • for in for - O(N2)
  • B-tree - O(log(N))
  • Simple sort O(N)