Message Queues (RabbitMQ +)

Rabbit MQ:{

Part 1: Concepts and Basics.
Part 2:
Part 3:
Part 4:
Advanced: {
Exchanges:{Direct, Fanout, Topic, Header}, Routing Key, Bindings, AMQP, Users
rabbitmqctl: broker
Built using : erlang

Setting Up :{
Management Panel: 15672
AMCQ : 5672.

Debug Issues :{


Commands :{
start_stop: {invoke-rc.d rabbitmq-server stop/start/etc,
sudo service rabbitmq-server stop}
controlling the Broker :{
rabbitmqctl stop/start
/etc/logrotate.d/rabbitmq-server (to configure logrotate for rabbitMQ)}
config & system limits:{
controlling fs.file-max with sysctl
rabbitmq-env.conf <- uLimit -S -n 4096 (soft limit)
/etc/security/limits.conf (for hard limit)
(search for file-descriptors – includes network sockets & file handles.
network descriptors – network sockets managed by Rabbit-mq)
status: {rabbitmqctl status}

Hands On with RabbitMQ :{
1. Creating Queues
2. Pub Sub messages in Queue
3. Dashboard.
4. Queues and Messages from code.

JS Sources
Memory Mgmt
Concurrency & Event Loop

enumerable property, hasOwnProperty is derived from Object.prototype => to check whether the property is derived.

To check whether an object has a property defined on itself and not somewhere on its prototype chain, it is necessary to use the hasOwnProperty method which all objects inherit from Object.prototype.

hasOwnProperty is the only thing in JavaScript which deals with properties and does not traverse the prototype chain.

Object.create(), new

prototype and Object.getPrototypeOf
– prototype works with new operator. by setting the source prototype reference to the target prototype property before the constructor is called.
obj.[[Prototype]] = o.Prototype
The properties of a javascript are first checked at the object level, then the prototype level.
Prototype is basically a way to enable polymorphism in javascript. When a property is not available directly in an object, the evaluation happens through Object.getPrototypeOf(a1).fn()
In short, prototype is for types, while Object.getPrototypeOf() is the same for instances.
Prototype check is recursive.
This means that all the stuff you define in prototype is effectively shared by all instances, and you can even later change parts of prototype and have the changes appear in all existing instances, if you wanted to.

Object type and object instance. OOP in JS is classless, prototype-oriented, or instance-based programming – that uses polymorphism.

Using Callbacks:
Callbacks can be used in various utilities. The use of callbacks is for saving the state of values that were available to us when the callback was issued. This data can be returned in a synchronous way. Returning it in synchronous way is necessary since the state must be update with the correct values before it is returned. 

Angular JS:

AngularJS’ Internals In Depth


To Engineers Who Tried to Use Jade Template Engine and Can’t Get Started

Client-side rendering vs Server side rendering:

Client vs serverside rendering – the big battle?

__proto__ -> Function.prototype

Microservices – What is it. Going Faster with them

There are some important Principles of microservices(defining microservices). – Martin Fowler

Whom to call a microservice –

Component Design – Libraries and Services.
Organised around the BUSINESS Capabilities and not the technologies. These teams should be directly responsible right upto the end user experience.
Having their own DATA boundaries. Every service should have their own database.Even SOA had different services but the same DB source. Doing this will separate schema and make them free to choose the data source they see correct.
They should have smart endpoints, unlike the ESB.
Monitoring is a must in order to cope up with service failures.
Infrastructure Automation is needed since there can be multiple types of systems that the services can interact with or created with. Continuous Devlivery etc are mandatory.
Build for failure. The remote service will fail. Similar to Netflix which makes it resilient.
Multiple versions acceptable. Self – monitoring. Loosely Coupled

Team size: Pizza sized teams.
– When to use &amp; what are the advantages.
The microservices preserve modularity but make refactoring difficult.
Partial Deployment can be easily achieved in Microservices unlike monolith applications.
They are highly available but lack consistency.
They are platform independent.
– Must have if you are adopting microservices.
Rapid Provisioning of resources
Rapid Deployment
Have DevOps Culture


Challenges in Implementing Microservices: – Fred George

The need of microservices – To Go Faster.

The organizations and startups want to move faster and with so many tools available today, like Docker, Cassandra, NoSql and terminologies and culture shift like MVP, Cloud, DevOps, these contribute in creating a pattern of development that helps move things faster and increase the rate of development.

Why ?
There are different types of problems and there is a lot of competition in the market.
Challenge 1.Deconstructing the database.
-Fortune 100 eg- Entity oriented, consistency essential.

As per Microservices: Event Buses to be used to replace operational databases.
DB per microservice if persistence is required. Multiple options for FBs
Few, writeable or transactional.

Rapids, Rivers and Ponds:
Rapids – Every Event. (Every message at every place – even the logs) in the same stream of information. Traffic stats, Service Stats.
Rivers – Themed Events : Reports etc.
Ponds – State/History, Events or Entities

This requires a high performance event bus. KAFKA. bus behind LinkedIn
250000 msgs per sec. It is a dumb bus. Also matters how many things we attach in the bus, which will decrease the number of events required.

We can attach certain message and then other messages for the rivers and use RabbitMQ.

We then attach the services to these events.
Handing Of messages to services based on corresponding traits.
We listen to a river but we always publish it to the rapids.
People might not see it if we push it to Rivers.

This helps us to build incremental applications.

a) There are event publishers and Solution Collectors. These communicate the event and get the response or solution of the event. Redis will serve as the db and cache it.

Challenge 2: Synchronous vs Asynchronous
Sync service – Turning module into services and calling them restfully.
Async – gives robustness, A/B testing can be done

Need Async Pattern : Need and Solution and working with the event bus.

Multiple Service Taxonomy depending on the client – timeout, web sockets, batch jobs. The processes can be of type – Soltion services, solution blockers, Client Biases, Enrichment Services.
And above all, everything is getting logged along with monitoring and KPIs

Chalenge 3 – Microservices or Clojure (Functional Programming)-
Microservices are like OO. Has its own persistence.
Closures – They love shared data and can only make new data can change old one. Eg. The UI of DailyMail from 130000 lines of Java to 4000 lines of closure. They have a big json structure of the page and it creates the html structure of the page. These are not reqd to make as a services.

a) Ruby – frontend, Node for monitoring, Closure – heavy lifting and monitoring. Analysis with R.

Coupling – DB, Rest, Kafka

b) DailyMail :
Clojure – 3 services.
Node.js – dozens of node js(with avg size of 14 lines of code)
Rabbit –

c) Outpace : Clojure – 25
Orchestrations, RabbitMQ

Solution : Elixir – Functional programming languages built on Erlanf VM.

Challenge 4- Choosing Architectures and Frameworks: Too early to tell

Netflix frameworks. Pigato (based on ZeroMQ),

Challenge 5 – No Design Patterns yet.

Challenge 6 – Corequisite Technology, Processes, Organization structure. Dev Ops concepts, Mangerless processes.

Microservices – Implementations

Spotify –

Scale to millions of users.
Platform independent.
Complex business rules.
Innovate fast and respond to competitions.

How they do it – Autonomous full-stack teams. – writing services that focus on composability, simplicity, High performance, modern Java Idioms and features.

Pain Points of microservices – documentation. Harder to monitor.
Create increased latency since all the services are calling other services – View Aggregation services to solve that. (Idea from Netflix)

Netflix –

Next generation monitoring platform – atlas architecture and need.

protobuf – binary serialization formats. Image sizes, prefetch requests. close tcp connections (keep-alive is kept on)

UI Engineering –

Linux commands for search

To search a gzipped file:
zcat mobileapi-29.txt.tar.gz | cut -d ‘ ‘ -f 7,11 –output-delimiter=’      ‘ | egrep -a -oe ‘mobileapi/api_app_session.php(.)* ‘  -oe ‘<(.)*>’

– Filter based on egrep condition.
zcat mobileapi-29.txt.tar.gz | cut -d ‘ ‘ -f 7,11 –output-delimiter=’      ‘ | egrep -a -e ‘mobileapi/api_app_session.php(.)* ‘


– Find with print and  xargs  find … -print 0 | xargs

zcat, awk, egrep, grep, zgrep.

Swift 2.2 & 3.0 Features and Proposals
Swift 3.0

– Requiring Leading Dot Prefixes for Enum Instance Member Implementations:  This is done to remove confusion with different standards at different places.
– Features related to Swift Project Manager  ! Long Proposal

Swift 2.2 features:
Providing some default tuple comparison.
– Naming Functions with Argument Labels in case of function overloading
– typealias and associatedtype
Associated type now use the associatedtype keyword and typealias is available for implementing true associated type aliases. Earlier typealias keyword was used outside of protocols to declare type aliases and in protocols to declare associated types. Now it looks like this.

protocol Sequence {
  associatedtype Iterator : IteratorProtocol
  typealias Element = Iterator.Element

typesaliases refers to Generic Type Aliases. It allows type aliases to introduce type parameters, which are in scope for their definition.

– Expanding Swift Self to class members and value types
Self.dynamicType -> ‘Self’ to as shorthand for referring to the containing type (in the case of structs, enums, and final class) or the dynamic type (in the case of non-final classes).