The Polymathic Engineer

Share this post

Proxies

newsletter.francofernando.com

Proxies

What are proxies and the difference between forward and reverse proxies. Plus the most important definitions to know about graphs.

Franco Fernando
Feb 13
Share this post

Proxies

newsletter.francofernando.com

Hi Friends,

Welcome to the 12th issue of the Polymathic Engineer newsletter.

Today we will talk about:

  • What are proxies

  • The difference between forward and reverse proxies

  • what are the main definitions to know about graphs

  • coding challenge

  • two interesting tweets

Proxies

Proxies are a fundamental component of almost every distributed system. According to its definition, a proxy is a server acting as an intermediary between a set of clients and a set of servers.

There are many types of proxies, but all of them belong to 2 categories: forward and reverse.

Forward proxies

A forward proxy is a server configured to act on behalf of a client. The client's requests go to the proxy instead of the server. The proxy forwards the requests to the server and waits for responses sending them back to the client.

In this way, the server doesn't know who the client is. It only knows the source IP address of the proxy. So a forward proxy can secure and hide the identity of the client. VPNs work according to the same principle.

Using a forward proxy, clients can access servers they wouldn't be supposed to access. But using forward proxies also has advantages at the system level since they can:

• selectively send/block requests

• log or monitor requests

• cache responses

Reverse proxies

A reverse proxy is a server configured to act on behalf of another server. The proxy receives the client's requests instead of the server. The proxy forwards the requests to the server and waits for responses sending them back to the client.

The client has no idea that it is communicating with the reverse proxy. The responses are returned to the client, appearing to originate from the server itself. So a reverse proxy can secure and hide the identity of the server.

The main advantages of using reverse proxies are:

• Load balancing among a group of servers

• Anonymity and increased security for the servers

• Better performances, executing additional tasks in place of the servers

For example, reverse proxies can cache static content reducing the overall system latency. Or they can take the load off of the servers performing additional tasks like:

• Data compression and decompression

• Data encryption and decryption

• HTTP authentication

Introducing reverse proxies in a system also has disadvantages:

• the system complexity increases

• reverse proxies redundancy is necessary to avoid single points of failure

As usual, using a reverse proxy layer in a system, it's a matter of trade-offs.

Additional resources

If you want more details about proxies, you can check out this article I posted on my personal website.

Thank you for reading The Polymathic Engineer. This post is public so feel free to share it.

Share

Graph definitions

Graphs are a very flexible data structure. The only one that can capture any real-world data and model any relationship.

Here the basic glossary with all the definitions that a developer should know about graphs.

  1. Node (or vertex): a single unit of data

  2. Edge: a connection between 2 nodes

  3. Order: number of nodes in the graph

  4. Size: number of edges in the graph

  5. Node degree: number of edges incident to the node

  6. Isolated node: a node not connected to any other node in the graph (with 0 degree)

  7. Adjacent nodes: 2 nodes connected by an edge

  8. Self-loop: an edge from a vertex to itself

  9. Multi-edge: an edge occurring multiple times

  10. Directed graph: a graph where all the edges have a direction from one node to another

  11. Undirected graph: a graph where all edges have no direction

  12. Weighted graph: a graph where each edge has assigned a numerical value or weight

  13. Unweighted graph: a graph where all edges have no weights

  14. Sparse graph: a graph where only a tiny fraction of the possible node pairs are connected

  15. Dense graph: a graph where a significant fraction of the vertex pairs are connected

  16. Path: a sequence of edges and nodes from a source to a destination node

  17. Path length: number of edges in a path

  18. Cycle: a path where the source and destination nodes are the same

  19. Connected graph: a graph where there is a path between any pair of nodes

  20. Acyclic graph: a graph not containing any cycle between its nodes

  21. Trees: connected, acyclic undirected graphs

  22. Cyclic graph: a graph containing cycles between its vertices

  23. DAG: a directed acyclic graph. Helpful to model data with precedence constraints

  24. Bipartite graph: a graph where nodes can be marked using 2 colours so that no adjacent nodes have the same colour

Thanks for reading The Polymathic Engineer! Subscribe for free to receive new posts and support my work.

Coding challenge

The coding challenge from last week was Valid Parenthesis. The problem asks to process a string of parentheses and check that they match in the correct order. The nature of the problem bring to process characters in LIFO order.

If the current character is a closed brackets it should match with the last inserted open brackets. Using a stack to process the data in the input string comes natural for this problem.

Instead of hardcoding brackets into the code, a more elegant solution is to encode the correspondences between open and closed bracket into a dictionary.

The time complexity of this solution is O(N) time and O(N) space.

The coding challenge for the next week is Implement Queue using Stacks.

Interesting Tweets

Idempotency means that the effect of a successful request on a server resource is independent of the number of times it is executed. This tweet provides a good mental map of all the considerations necessary to implement idempotent APIs.

Twitter avatar for @embano1
Michael Gasch 🇩🇪🇺🇦 @embano1
In event-driven systems, #idempotency is often critical for deterministic behavior in the presence of failure. „Just make your APIs idempotent“ they say :) Here’s a mind map (incomplete) snippet I created this week to capture some important considerations. Anything missing?
Image
11:44 AM ∙ Feb 5, 2023
129Likes13Retweets

The more you work in the software industry, the more you realize that knowing everything is impossible. And that soft skills are at least as relevant as technical ones.

Twitter avatar for @hussien_coding
Hussien 🇨🇦 @hussien_coding
When I was a junior developer I thought I had to know everything. It really stressed me out But I learned that the companies I worked for weren't looking for that. They want me to be hungry, curious, resourceful, constantly learning and do it all with a good attitude.
2:12 PM ∙ Feb 8, 2023
78Likes5Retweets

Everyone can become a developer without a CS degree. But in my opinion, a CS degree is still the most comfortable path to become a developer.

Twitter avatar for @Madisonkanna
Madison Kanna @Madisonkanna
It’s true that you don’t need a CS degree to become a developer But I’m starting to think we’ve undersold the importance of having a solid understanding of computer science if you want to be a great developer
7:09 AM ∙ Feb 6, 2023
9,246Likes719Retweets

Thanks for reading The Polymathic Engineer! Subscribe for free to receive new posts and support my work.

Share this post

Proxies

newsletter.francofernando.com
Comments
TopNewCommunity

No posts

Ready for more?

© 2023 Franco Fernando
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing