Hussein Nasser's Blog
January 12, 2025
November 4, 2022
YouTube Channel
Published on November 04, 2022 13:34
May 6, 2021
Following an HTTP GET / through Switches, Routers, Gateways, and Proxies (Detailed Examples)

In this networking video, I’ll explain the difference between a gateway and a proxy but also illustrate the purpose behind routers and switches in the process. I’ll execute an HTTP GET request and follow its on-wire representation across multiple networks. Follow timestamps for the 3 examples I'll use.

Published on May 06, 2021 12:23
December 4, 2020
Will AWS Babelfish Succeed in Moving Developers Away from SQL Server to Postgres?
In AWS re-invent, Amazon announced open-sourcing Babelfish for PostgreSQL, a SQL Server-compatible end-point for PostgreSQL to make PostgreSQL fluent in understanding communication from apps written for SQL Server. Let us discuss what is this technology and whether if it's gonna really move developers away from Microsoft SQL Server to Postgres
Resources https://aws.amazon.com/blogs/opensour... Watch the video here
Published on December 04, 2020 07:34
April 21, 2020
System Design and Backend Engineering Videos From Zero to Hero
This collection of videos covers major system design concepts and fundamentals that every backend engineer needs to understand. This will help you in your design interviews. The videos are ordered in the way they should be consumed.
Backend Engineering Playlist
Backend Engineering Playlist

Published on April 21, 2020 07:55
March 11, 2020
SameSite Cookie Attribute Explained by Example (Strict, Lax, None & No SameSite)
The recent version of Chrome has broke some workflows with samesite cookies. So a few weeks ago I made a video discussing the samesite Attribute change in chrome and how it is a great change that will end CSRF.
It looks like Chrome 80 is officially out now and websites are broken or stuck in infinite loops. This is because Cookies without samesite Attribute are treated as samesite lax which means cookies will not be sent except if it is a GET request and top-level navigation clicking on a link
It looks like Chrome 80 is officially out now and websites are broken or stuck in infinite loops. This is because Cookies without samesite Attribute are treated as samesite lax which means cookies will not be sent except if it is a GET request and top-level navigation clicking on a link

Published on March 11, 2020 19:18
February 29, 2020
gRPC Pros & Cons
gRPC (gRPC Remote Procedure Calls) is an open source remote procedure call (RPC) system initially developed at Google in 2015. It uses HTTP/2 for transport, Protocol Buffers as the message format. In this video I want to explore gRPC, go through examples, pros and cons of gRPC.
Client/ Server communication - SOAP - HTTP (REST) - WebSockets Client Libraries gRPC gRPC Demo - todos gRPC Pros and Cons Pros - Fast two/uni and request - Unform - One library to rule them all - Progress feedback( long synchronous requests) drop pluggable wait...) - cancel request - All benefits of H2 and Protobuff Cons- schema based (not everyone wants schema) - Thick client - limited languages - Proxies still don’t understand it - Still young - Error handling - No native browser support - Timeouts, circuit breaker just like any RPC (pub/sub rules in this case) Can you create your own protocol? - Spotify example with Hermes Source Code https://github.com/hnasr/javascript_p... Timecode Motivation - 4:30 -Client Server Communication 4:30 -THe problem with client libraries 8:40 - Why GRPc gRPC - modes 16:40 - Unary - 17:20 - server streaming 17:40 - client streaming 18:30 - bidirectional 19:10 Coding : 19:40 Pros & Cons 57:00 Build own : 1:12:30 cards 00:30 H/2 7:00 graphQL 8:00 WebSockets 23:00 protobuff Resources https://grpc.io/docs/guides/ Haproxy grpc https://www.haproxy.com/blog/haproxy-... Nginx grpc https://www.google.com/amp/s/www.ngin... https://grpc.io/docs/guides/concepts/
Client/ Server communication - SOAP - HTTP (REST) - WebSockets Client Libraries gRPC gRPC Demo - todos gRPC Pros and Cons Pros - Fast two/uni and request - Unform - One library to rule them all - Progress feedback( long synchronous requests) drop pluggable wait...) - cancel request - All benefits of H2 and Protobuff Cons- schema based (not everyone wants schema) - Thick client - limited languages - Proxies still don’t understand it - Still young - Error handling - No native browser support - Timeouts, circuit breaker just like any RPC (pub/sub rules in this case) Can you create your own protocol? - Spotify example with Hermes Source Code https://github.com/hnasr/javascript_p... Timecode Motivation - 4:30 -Client Server Communication 4:30 -THe problem with client libraries 8:40 - Why GRPc gRPC - modes 16:40 - Unary - 17:20 - server streaming 17:40 - client streaming 18:30 - bidirectional 19:10 Coding : 19:40 Pros & Cons 57:00 Build own : 1:12:30 cards 00:30 H/2 7:00 graphQL 8:00 WebSockets 23:00 protobuff Resources https://grpc.io/docs/guides/ Haproxy grpc https://www.haproxy.com/blog/haproxy-... Nginx grpc https://www.google.com/amp/s/www.ngin... https://grpc.io/docs/guides/concepts/
Published on February 29, 2020 18:49
December 21, 2019
Database Engines Crash Course (MyISAM, Aria, InnoDB, XtraDB, LevelDB & RocksDB)
Database Engines Crash Course (MyISAM, Aria, InnoDB, XtraDB, LevelDB & RocksDB)
Database engines or storage engines or sometimes even called embedded databases is software library that a database management software uses to store data on disk and do CRUD (create update delete) Embedded means move everything in one software no network client-server. In this video I want to go through the few popular database engines, explain the differences between them and finally I want to spin up a database and change its engine and show the different features on each engine Timecodes What is a database Engine 3:00 myISAM 9:43 Aria 16:30 InnoDB 19:00 XtraDB 25:30 LevelDB 27:40 RocksDB 34:00 SQLite 38:11 BerkelyDB 42:00 Demo! 47:11 Cards ACID 4:30 mysql/javascript 56:17 Resources https://youtu.be/V_C-T5S-w8g https://mariadb.com/kb/en/library/cha... https://mariadb.com/kb/en/library/why... https://github.com/facebook/rocksdb/w... https://mariadb.com/kb/en/library/ari... https://dev.mysql.com/doc/refman/8.0/... https://eng.uber.com/mysql-migration/
Database engines or storage engines or sometimes even called embedded databases is software library that a database management software uses to store data on disk and do CRUD (create update delete) Embedded means move everything in one software no network client-server. In this video I want to go through the few popular database engines, explain the differences between them and finally I want to spin up a database and change its engine and show the different features on each engine Timecodes What is a database Engine 3:00 myISAM 9:43 Aria 16:30 InnoDB 19:00 XtraDB 25:30 LevelDB 27:40 RocksDB 34:00 SQLite 38:11 BerkelyDB 42:00 Demo! 47:11 Cards ACID 4:30 mysql/javascript 56:17 Resources https://youtu.be/V_C-T5S-w8g https://mariadb.com/kb/en/library/cha... https://mariadb.com/kb/en/library/why... https://github.com/facebook/rocksdb/w... https://mariadb.com/kb/en/library/ari... https://dev.mysql.com/doc/refman/8.0/... https://eng.uber.com/mysql-migration/

Published on December 21, 2019 07:15
November 2, 2019
Javascript by Example 3 hour free course
This is a practical Javascript course by example, we will build a calculator from scratch in this course enjoy.
Chapter 1 Title: Getting Started Time Code: 5:00 Source Code: https://github.com/hnasr/javascript-b... Chapter 2 Title: Building User Interface Time Code: 21:12 Source Code: https://github.com/hnasr/javascript-b... Chapter 3 Title: DOM, Events & Functions Time Code: 50:30 Source Code: https://github.com/hnasr/javascript-b... Chapter 4 Title: Arrow Functions Time Code: 1:28:05 Source Code: https://github.com/hnasr/javascript-b... Chapter 5 Title: Evaluate Expressions (eval) Time Code: 1:44:44 Source Code: https://github.com/hnasr/javascript-b... Chapter 6 Title: Conditions Time Code: 1:56:16 Source Code: https://github.com/hnasr/javascript-b... Chapter 7 Title: Running on Mobile Time Code: 2:07:39 Source Code: https://github.com/hnasr/javascript-b... Chapter 8 Title: CSS, Arrays & Loops Time Code: 2:20:55 Source Code: https://github.com/hnasr/javascript-b... Chapter 9 Title: Debugging Time Code: 2:42:31 Source Code: https://github.com/hnasr/javascript-b... Stay Awesome! Hussein

Published on November 02, 2019 19:06
August 4, 2019
Layer 4 vs Layer 7 Load Balancing Pros and Cons
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; min-height: 14.0px} li.li1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'} ul.ul1 {list-style-type: hyphen}
Load balancing is the process of balancing incoming requests to multiple machines, processes or services. In this video, we will explain two types of load balancers, layer 4 and layer 7. You can watch the video or read the summary below.
Layer 4 Load balancer (HAProxy, NLB)Forwards packets based on basic rules, it only knows IP and PORT and perhaps latency of the target service. That is what is available at Layer 4/3. This load balancer doesn't look at the content so it doesn't know the protocol whether its HTTP or not, it doesn't know the URL or the path or the resource you are consuming or whether you are using GET or POST.
ProsGreat for simple packet-level load balancingFast and efficient doesn’t look at the dataMore secure as it can't really look at your packets. So if it was compromised no one can look at the data.Doesn't need to decrypt the content it merely forwards whatever content in it. Uses NAT One connection between client and server NATed so your load balancer can serve a maximum number of tcp connections = to (number of servers * max connections per server) ConsCan't do smart load balancing based on the content, such as switch request based on the requested media typeCan't do real microservices with this typeHas to be sticky as it is a stateful protocol (all segments) once a connection is established it goes to one server at the backend. All packets flowing to this connection goes to one server. The next connection will pick another server based on the algorithm.
Layer 7 (Nginx , HAProxy)
This type of proxy actually looks at the content and have more context, it knows you are visiting the /users resource so it may forward it to a different server. Essential and great for microservices, it knows the content is video:image and it can do compression. It can add its own headers so other proxies or load balancers can see that this has passed through a proxy. It can also cache, we can't really do caching on layer 4 because we have no clue whats in the packets.
But this is expensive because it has to decrypt and look and compute.
ProsSmart routing based on the URL (microservices) flexible Provide cachingConsExpensive need to decryptSecurity, you have to share your certificate with the load balancers. if an attacker compromised the load balancer they have access to all your data.Proxy creates multiple connections (client to proxy/proxy to server) So you are bounded by the max TCP connection on your load balancer. Example if your load balancer supports 200 max TCP connections and you have 5 backend servers the load balancer servers each with 200 max connection. Your load balancer can only serve (concurrently) (200 - 5) clients. 5 connections are from the load balancer to each backend server and 195 available for clients. Where if that was a layer 4 load balancer you can server 200*5 connections.
With all those cons we almost have to use Layer 7 load balancer because the benefits outway the cons, especially that we don't have resources constraints.
Load balancing is the process of balancing incoming requests to multiple machines, processes or services. In this video, we will explain two types of load balancers, layer 4 and layer 7. You can watch the video or read the summary below.
Layer 4 Load balancer (HAProxy, NLB)Forwards packets based on basic rules, it only knows IP and PORT and perhaps latency of the target service. That is what is available at Layer 4/3. This load balancer doesn't look at the content so it doesn't know the protocol whether its HTTP or not, it doesn't know the URL or the path or the resource you are consuming or whether you are using GET or POST.
ProsGreat for simple packet-level load balancingFast and efficient doesn’t look at the dataMore secure as it can't really look at your packets. So if it was compromised no one can look at the data.Doesn't need to decrypt the content it merely forwards whatever content in it. Uses NAT One connection between client and server NATed so your load balancer can serve a maximum number of tcp connections = to (number of servers * max connections per server) ConsCan't do smart load balancing based on the content, such as switch request based on the requested media typeCan't do real microservices with this typeHas to be sticky as it is a stateful protocol (all segments) once a connection is established it goes to one server at the backend. All packets flowing to this connection goes to one server. The next connection will pick another server based on the algorithm.
Layer 7 (Nginx , HAProxy)
This type of proxy actually looks at the content and have more context, it knows you are visiting the /users resource so it may forward it to a different server. Essential and great for microservices, it knows the content is video:image and it can do compression. It can add its own headers so other proxies or load balancers can see that this has passed through a proxy. It can also cache, we can't really do caching on layer 4 because we have no clue whats in the packets.
But this is expensive because it has to decrypt and look and compute.
ProsSmart routing based on the URL (microservices) flexible Provide cachingConsExpensive need to decryptSecurity, you have to share your certificate with the load balancers. if an attacker compromised the load balancer they have access to all your data.Proxy creates multiple connections (client to proxy/proxy to server) So you are bounded by the max TCP connection on your load balancer. Example if your load balancer supports 200 max TCP connections and you have 5 backend servers the load balancer servers each with 200 max connection. Your load balancer can only serve (concurrently) (200 - 5) clients. 5 connections are from the load balancer to each backend server and 195 available for clients. Where if that was a layer 4 load balancer you can server 200*5 connections.
With all those cons we almost have to use Layer 7 load balancer because the benefits outway the cons, especially that we don't have resources constraints.

Published on August 04, 2019 06:40