<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Zuhayr Adib Elahi on Medium]]></title>
        <description><![CDATA[Stories by Zuhayr Adib Elahi on Medium]]></description>
        <link>https://medium.com/@zuhayradibelahi?source=rss-5ef2067bb733------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*TY1Aj470S6A0G9UY.jpg</url>
            <title>Stories by Zuhayr Adib Elahi on Medium</title>
            <link>https://medium.com/@zuhayradibelahi?source=rss-5ef2067bb733------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 19:38:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zuhayradibelahi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Git]]></title>
            <link>https://medium.com/@zuhayradibelahi/git-1f310284fcc8?source=rss-5ef2067bb733------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f310284fcc8</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Zuhayr Adib Elahi]]></dc:creator>
            <pubDate>Fri, 18 Sep 2015 05:13:56 GMT</pubDate>
            <atom:updated>2015-09-18T05:13:56.071Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<p>Git — a source control repository used by many companies and individuals. II wanted to explore the architecture behind Git and understand what really all the commands such as <em>git init</em> or <em>git add </em>are doing. I went through and read about the architecture behind git and looked through the source code at:<a href="https://github.com/git/git"> <em>https://github.com/git/git</em></a><em> </em>to better understand the architecture behind it and gain an overall better understand of how our source code is managed on Github.</p><h4>The Origin</h4><p>Git came out of a need. As the Linux kernal was being developed, there were three big problems which needed to be addressed: large amount of contributors, the source code was getting bigger, and the need for an easier way to manage the source code.</p><p>There were three usability design goals behind git:</p><ul><li>Support distributed workflows</li><li>Offer safeguards</li><li>High performance</li></ul><p>This led the designers to build git using DAGs. A DAG is a directed acyclic graph. This design is very important to git as it is used to store content, reference pointers for heads, object model representation, and remote protocols.</p><h3>Version Control System Design</h3><p>There are three functions for a Version Control System(VCS):</p><ul><li>Store content</li><li>Track content changes</li><li>Disturb content and history with collaborators</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*BGv5RkDk-MMenXzNEilwrA.png" /><figcaption>blob.c — code taken from <a href="https://github.com/git/git">https://github.com/git/git</a></figcaption></figure><h4>Content Storage</h4><p>There are two design choices for storing content in VCS: <em>delta-based changeset</em> or a <em>directed acyclic graph(</em>DAG). A DAG has objects forming a hierarchy to mirror the content filesystem tree which gives a snapshot of the commit. Git stores content as a DAG using different types of objects. The file:<em> blob.c — </em>is how information is stored in git. The code written above is from the file: <em>blob.c</em>. The information is stored as an object and uses an sha1 to validate the blob.</p><p>The blob is then stored in a tree. This tree is shown at <em>tree.c</em>. There are multiple <em>read_one_entry</em> functions, which are used to read the blobs and store them into trees. There are also two read_tree functions. One is implemented with recursion and another is implemented iteratively. These two files in combination with each other are how files are stored in a repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*pl36jAzRRp8FqY57S4WASA.png" /><figcaption>Tree depicting how commits are made and stored in git. — There is a tree used for each directory which stores blobs.</figcaption></figure><h4>Commit and Merge Histories</h4><p>VCS software usually uses one of the following approaches to track changes:</p><ul><li>Linear History</li><li>Directed Acyclic graph for history</li></ul><p>Git uses DAGs to store a project’s history. Each commit contains metadata regarding its ancestors. It also has the ability to directly support branching to record most merge history cases. Having a DAG storing the contents, allows Git to:</p><ul><li>have nodes with the same identity as those in many different commits</li><li>allow nodes to merge the their contents</li></ul><h4>Distribution</h4><p>The three ways VCS offers methods of storing and distributing data, which include:</p><ul><li><em>Local-only: </em>all source code is stored locally</li><li><em>Central Server: </em>one specific repository used to store all changes to the repository</li><li><em>Distributed model: </em>Each individual has their own local workspace where each person works, and then pushes commits to a remote repository.</li></ul><p>Git follows a distributed model in conjunction with a central server to store changes. When storing changes for Git, all changes are first stored locally. and then the pending commits are pushed to a public repository. The public repository is used by all individual contributors. For the local commit, the local Git repository creates a new object to represent the file that was changed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*228AbeDnx74CCKlCWye1Rw.png" /><figcaption>what happens when a commit is made</figcaption></figure><p>When a new file is created, a new tree object is added. A DAG is then created starting from the newly created tree objects which then point to blobs, and reference the newly created blob. The two levels of added complexity allow for greater flexibility for the workflow and publishing capabilities.</p><p>Note: A <em>blob</em> represents a file stored in the repository</p><h3>The Toolkit</h3><p>The Github toolkit includes many command line and UI tools on various operating systems. (There is even a Github for Windows project started by the open source community). The majority of the toolkit was written to be very similar to the Unix tradition of the command line.</p><p>The toolkit is divided into two parts: the <em>plumbing</em> and the <em>porcelain</em>. The plumbing consists of low-level commands to enable content tracking and DAG manipulation. The porcelain is a subset of git commands used to maintain repositories and communicate between repositories for collaboration.</p><h3>The Repo</h3><p>To initialize a git repository or to turn an existing local directory to a Git repository, the user issues <em>a git init</em> command. This command creates a .git sub directory, which consists of the following files:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/124/1*F6-Yb2XfQjI2SAvOfuTYwQ.png" /><figcaption>contents of the .git folder</figcaption></figure><p>The .git repositories consists of the following sub directories</p><ul><li><strong><em>Configuration</em></strong><em>: </em>the .git/config, .git/description, and .git/info/exclude files are used to configure the local repository.</li><li><strong><em>Hooks</em></strong><em>: </em>the .git/hooks directory contains scripts that run during certain life cycle events</li><li><strong><em>Staging</em></strong><em> </em><strong><em>Area</em></strong><em>: </em>the .git/index file is the staging area for the working directory</li><li><strong><em>Object</em></strong><em> </em><strong><em>Database</em></strong><em>: </em>the <em>objects </em>directory is the default Git object database. It contains all contents and pointers to local content.</li><li><strong><em>References</em></strong>: the refs directory is the default location to store reference pointers for both local and remote repositories, tags and heads.</li></ul><p>The .<em>git </em>directory is the actual directory which contains a working set of files. the directory which is the parent to the .git directory, consists of the local repository files. An empty git repository can be initialized using the command, <em>git init — bare</em>. This creates a git repository without a working directory</p><p>The <em>Git index: </em>git/index, is another important file which provides the staging area between local and remote repositories. It stages specific changes within one file. Specific changes to a file can be added using: <em>git add -p</em>.</p><p>In addition to the files in the <em>.git </em>directory, it is important to understand what happens when some of these commands are executed.</p><ul><li><em>git checkout [branch]: </em>moves the HEAD reference of the local repository to branch reference path, populate the index with the head data and refresh the working directory.</li><li><em>git add [files]: </em>cross references the checksums of the files with the corresponding entries in the Git index to see if the files in the remote repository need to be updated.</li></ul><h3>The Object Database</h3><p>Every object in the local repository is built around four basic primitive objects. These object types are:</p><ul><li><em>Tree: </em>an element in a tree can be another tree or a blob</li><li><em>Blob: </em>a file stored in the repository</li><li><em>Commit: </em>a commit points to a tree representing the top level directory for that commit and parent commits</li><li><em>Tag: </em>a tag has a name and points to a commit at the point in the repository history that the tag represents</li></ul><p>A SHA (a 40-digit object identity) is used to reference primitive objects. If two objects are identical, then they will have the same SHA. The properties of the SHA guarantee the identity of the object and help to enable some safeguards against corruption.</p><h3>Storage and Compression Techniques</h3><p>Git handles storage by packing objects in a compressed format, and uses an index file to locate specific objects in the corresponding packed file. The command <em>git count-objects</em> is used to count the number of loose objects in a local Git repository.</p><p>The packet file format evolved. The initial format stores CRC checksums for the pack file and the index file in the index file itself. Git establishes remote communications by calculating the commits and contents that need to be sent over the wire to synchronize repositories. It also generates the pack file format on the fly to send back using the client’s protocol.</p><h3><strong>Merge Histories</strong></h3><p>Git handles merge history by storing the previous versions of the code using a DAG. The DAG allows git to know where on the current branch the changes are made. By having the changes on the head of the branch, git is able to see where the commits are being made.</p><h3><strong>Final Thoughts</strong></h3><p>The trade-offs and decisions that went into making git have led it to be one of the more successful VCS. It’s flexibility and implementation allows for many people to work on the same project. It has addressed and solved a majority of the problems the Linux Kernel developers were having with managing the kernel source code. There were definitely a lot of lessons learned while exploring git’s design.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f310284fcc8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Development with Security and Preparing for Attacks]]></title>
            <link>https://medium.com/@zuhayradibelahi/development-with-security-and-preparing-for-attacks-cee09233da9?source=rss-5ef2067bb733------2</link>
            <guid isPermaLink="false">https://medium.com/p/cee09233da9</guid>
            <category><![CDATA[computer-security]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Zuhayr Adib Elahi]]></dc:creator>
            <pubDate>Mon, 27 Jul 2015 04:49:57 GMT</pubDate>
            <atom:updated>2015-07-27T04:49:57.105Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*6aJP2JvL60aaH7BWxIjJwg.jpeg" /></figure><p>Ignoring security could be one of the biggest mistakes a business or a company makes. Not only does it hurt the user, but it negatively affects the business, damaging its reputations and exposing vulnerabilities. Regardless of what is being developed, all developers should consider security in their design. They should explore the tradeoff between<em> usability vs. security</em>, and the access points for the requested information.</p><h3>Ashley Madison</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*CTJCe4VR3LqGzngeXfBfBQ.jpeg" /></figure><p>Just recently <em>AshleyMadison.com,</em> a site people visit to have affairs was recently hacked<em>.</em> The hackers stole personal information from<em> Avid Life Media (ALM),</em> which stores information regarding users of various dating websites<em>. In addition to account data from 40 million users, the hackers also leaked maps of internal company servers, employee account information, and company bank account data and salary information. </em>The site claimed to have a <em>“full delete”</em> feature which erases all user information even from the backend servers for 20 dollars. However user information such as credit card information, and even personal details were found. This leak poses a threat to the customers and the site as hackers are threatening to release user information if the CEO does not take the site down.</p><p><strong><em>Read more at</em></strong><em>: </em><a href="http://krebsonsecurity.com/2015/07/online-cheating-site-ashleymadison-hacked/"><em>http://krebsonsecurity.com/2015/07/online-cheating-site-ashleymadison-hacked/</em></a></p><h4>Repercussions of ignoring security</h4><p>This type of hack poses a lot of risk to the business including:</p><ul><li>destroying the service’s reputation</li><li>Risk user lives by sacrificing confidential information</li><li>Decrease in revenue</li></ul><p>Regardless of the business, security is important. The hackers are now threatening to release critical user information until the site owner shuts itself down. The business and its leaders now have to make a critical decision whether they lose their business or the site’s users lives are now endanger.</p><h3>Venmo</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*_tU4trJQ25XzYQz265pUUw.jpeg" /></figure><p>Venmo is a mobile application used by individuals to transfer payments. A professional poker player, Mohsin Charania was hacked for $2,000 in 2014. Another individual, Brant Trinh, lost $3,000 from Venmo.</p><p>Mobile applications are also endanger of not being fully secure. Mobile banking apps are new. There are many challenges developing mobile banking apps. All these apps require money to be transferred wirelessly. Any information which is transferred wirelessly is susceptible to being hijacked.</p><p><strong><em>Read more at: </em></strong><a href="http://nextshark.com/venmo-hacked/#rmns"><em>http://nextshark.com/venmo-hacked/#rmns</em></a></p><h4>Consider Security for Development</h4><p><em>A security program must protect the confidentiality, integrity, and avalability of the data.</em></p><ul><li><strong><em>Confidentiality</em></strong>: allowing only authorized users to view the neccessary peices of information.</li><li><strong><em>Integrity: </em></strong>Ensure that only authorized user can modify the data.</li><li><strong><em>Availability</em></strong>: provide uninterrupted access by authorized users to important computer resources and data</li></ul><p>Confidentiality, integrity, and availability are the three core tenants to consider for security reasons. The designer has to be aware of the<em> threats which compromise security</em>, the<em> risks associated with the threats</em>, the <em>cost of implementing the proper countermeasures</em>, and finally <em>a cost-benefit analysis to determine if it is worth implementing those countermeasures</em>. The cost of implementing these security measures can really take a toll on the business, but is a neccessity to ensure the user’s safety. Making the correct trade-offs between the two really helps to identify flaws and vulnerabilities. It also identifies which assets are more important and helps developers prioritize their needs.</p><h4>Now What to do When You’re hacked</h4><p>Regardless of how much developers or businesses prepare, if someone wants to hack into the system, they will find a way. There is no stopping these individuals from stealing user data. It is important to recognize this and what to do when critical data is stolen. Having a mitigation plan or a backup plan can really help deal with these attacks. The backup plan will change depending on the business but dealing with these attacks and having a plan when getting hacked is very important.</p><h4>Conclusion</h4><p>As shown above through the recent hacks and attacks on networks, security is one of the most important concepts needed when developing a product. When a person users a service or website, there is a trust established. This trust is broken when there is a data breach and users lose their information as they cannot trust or rely on the service anymore. As important as it is to release a product quickly to the market, it is more important to have a way to deal with being hacked and making it as difficult as possible for hackers.</p><p><em>Note: As always, I really appreciate any comments or any suggestions as to how to improve upon what I write. So if you like what I wrote and feel it can be better please feel free to leave a comment.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cee09233da9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scalable Web Architecture]]></title>
            <link>https://medium.com/@zuhayradibelahi/scalable-web-architecture-412b09905d99?source=rss-5ef2067bb733------2</link>
            <guid isPermaLink="false">https://medium.com/p/412b09905d99</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Zuhayr Adib Elahi]]></dc:creator>
            <pubDate>Thu, 16 Jul 2015 02:46:56 GMT</pubDate>
            <atom:updated>2015-07-30T01:19:01.629Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*KvgvBYFrtP5dwgeqB36D6A.jpeg" /></figure><h3>Basics</h3><p>When building a website, it is always important to consider system architecture. The architecture for a system could be what makes or breaks the site itself. The backend of a website has many responsibilities including:</p><ul><li>Hosting the webpage</li><li>Storing user and website data</li><li>Handling user requests and service APIs</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*VToVm9xl35LI6yAlow6Ivg.jpeg" /><figcaption>Simplified Web Application</figcaption></figure><p>Therefore when designing a system architecture there are some very important components to consider. There are many core factors that need to be considered when building this system. These include:</p><ul><li>Services</li><li>Redundancy</li><li>Partitions</li><li>Failure Handling</li></ul><p>All four of these factors lead to different type of architecture. When one is favored over the other, we have a different type of system architecture which would be better for a website that serves a different purpose. For example, a <em>shared-nothing web architecture</em> may be more useful for an emergency services provider than a <em>service-based architecture</em>. All of these factors are important when designing an architecture to support different web processes. Making the right tradeoffs between those four factors can make or break a website. Learning to prioritize one over the other will lead to good system design concepts.</p><h4><em>Services</em></h4><p>Services are a vital part of system architecture. Some systems that are designed with each service as its own defined interface. Each service has it’s own distinct functional context, and interaction with anything outside of that context takes place through an abstract interface. By breaking down the system based on service, it defines the relationships between the service, underlying environment, and it’s customers. This enables individual components and services to scale independently and allows for easier debugging of a service when it goes down.</p><p>When adding services it is important to remember to consider the following principles:</p><ul><li>Determine the system’s needs</li><li>Benchmark alternatives</li><li>Understand system failures</li><li>Plan for Failures</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*tv5muCl6qHYuquTasjV3IA.png" /><figcaption>Elements of SOA, by Dirk Krafzig, Karl Banke, and Dirk Slama<a href="https://en.wikipedia.org/wiki/Service-oriented_architecture#cite_note-21">[21]</a></figcaption></figure><p>Systems design where each service has its own interface is known as a <em>Service-Oriented Architecture </em>(SOA).</p><blockquote><em>“ A </em><strong><em>service-oriented architecture</em></strong><em> (</em><strong><em>SOA</em></strong><em>) is an </em><a href="https://en.wikipedia.org/wiki/Architectural_pattern"><em>architectural pattern</em></a><em> in computer software design in which application components provide services to other components via a </em><a href="https://en.wikipedia.org/wiki/Communications_protocol"><em>communications protocol</em></a><em>, typically over a network. The principles of </em><a href="https://en.wikipedia.org/wiki/Service-orientation"><em>service-orientation</em></a><em> are independent of any vendor, product or technology. “ — </em><a href="http://msdn.microsoft.com/en-us/library/bb833022.aspx">Chapter 1: Service Oriented Architecture (SOA)</a></blockquote><p>A SOA helps to identify business needs much easier as services which are used more ofthen will be prioritzed and have the architecture revolve around them.</p><h4>Redundancy</h4><p>Redundancy is important to consider when to gracefully handle failures. Having multiple copies or different versions compensates for the failure of a single node. Redundancy removes single points of failure and provides backups or spare functionality in a crisis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*36HgyV3_GwmwHcYzDskGuQ.png" /><figcaption>Source: <a href="http://www.aodba.com/en/blog/2014/12/09/vertica-architecture-type/">http://www.aodba.com/en/blog/2014/12/09/vertica-architecture-type/</a></figcaption></figure><p>When redundancy becomes the most important aspect of the system architecture, we would consider a <em>shared-nothing architecture</em>, where each node operates independently. This helps with scalability as new nodes are added without special conditions or knowledge. In a shared-nothing architecture each node or service is independent and has no knowledge of the components of the other nodes or services in the system. The biggest advantage of this type of architecture is that it allows for no one single point of failure which can shut down the entire system.</p><h4>Partitions</h4><p>Partitions enable horizontal and vertical scaling. Both concepts allow systems to expand and scale based on user needs and demands. It allows for easier management of system components and helps with better understanding the different components.</p><p><strong><em>Vertical scaling</em></strong><em> </em>means adding more resources to an individual server. This is accomplished though having the individual resources handle more data and services then it normally could on it’s own.</p><p><strong><em>Horizontal scaling </em></strong>is adding more nodes to a an older system. This is an intrinsic principle for system architecture. Partitions allow for this to be implemented in practice. These partitions can be distributed based on different factors such as: <em>functionality, geographic boundaries, or other criterias.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*JXvRlCwNtOCKwiopQIwo-w.jpeg" /><figcaption>Architecture for a system with redundancy and partitioning</figcaption></figure><p>In this <strong><em>partition + redundancy based architecture</em></strong><em> </em>there are multiple servers used to store data and files. Data is duplicated across servers which allows different components quicker access to the resources it would need. These also allows for easier data recovery. When a certain piece of data is lost, it can be recovered from another server. These are two very big benefits to this sort of architecture, however modifying the original data becomes a challenge since there are now multiple points where the data must be modified.</p><p>To help with the challenge, an ID or unique key could be assigned to the specfic sets of data. This allows for easier tracking of files and helps to keep track of the different areas where the data needs to be modifed or updated.</p><p>The two key issues with a <em>partition + redundancy based architecture </em>are:</p><ul><li><strong><em>data locality</em></strong></li><li><strong><em>inconsistency</em></strong><em>.</em></li></ul><p>For data locality, the location of the partition to the operation point determines system performance. The further away the data, the higher the cost for fetching that information.</p><p>Inconsistency issues arise because ther could be a chance for race conditions when adding multiple resources. This could prevent the data the user is viewing or using from being accurate.</p><p>The two issues written above should be taken into account for system architecture design. However this sort of architecture is important when creating a system to be scalable.</p><h3>The Building Blocks of Fast and Scalable Data Access</h3><p>The two biggest challenges for scalable application design are:</p><ul><li>scaling access to the app</li><li>scaling access to the database</li></ul><p>There are multiple methods to handle these challenges including but not limited to:</p><ul><li>Caches</li><li>Proxies</li><li>Indexes</li><li>Load Balacing</li><li>Queues</li></ul><p>These are some approaches that could be used to solve problems with scalability. It also allows for systems to respond quicker to user requests and solve multiple problems when dealing with different features.</p><h4>Caches</h4><p>Caches take advantage of <strong><em>The Locality of Reference Principle</em></strong>. A <em>cache</em> is limited in space, but allows for quicker access to data than the original data source. Caches hold the most recently accessed items. These can be placed acrossed different parts of a system architecture, and depending on the placement of these caches, the chances of a cache miss could either decrease or increase.The two methods for dealing with this hurdle are: <em>global caches </em>and <em>distributed caches</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GDTyxvoPq5HyBO6anGtbSw.jpeg" /><figcaption>Diagrams depicting different caches. On the left is a global cache where the cache is responsible for retrieval. On the right is a global cache where the nodes themselves are in charge of retreiving data.</figcaption></figure><p><strong><em>Global Caches: </em></strong><em>A single space dedicated for cache space used by all the nodes in a graph. </em>A global cache requires either a simple server, or file store accessible by the request layer nodes. Either the cache or the nodes are responsible for data retreival.</p><p><strong><em>Distributed Caches:</em></strong> <em>In a distributed cache, each node is responsible for its own cache to store data. </em>This is usually implemented with a hashing function, such that each node can use that function to quickly look up in the cache if the data is avaliable.</p><h4>Proxies</h4><p>A <em>proxy</em> is an “intermediate piece of hardware/software that receives requests from clients and relays them to the backend origin servers.” There are several uses for proxies which can help improve the system performance, including:</p><ol><li><em>collapse forwarding</em> : speed up data access by collapsing the same requests into one request.</li><li><em>collapse requests : </em>collapse data that is located on similar data partitions or location.</li></ol><p>Placing a cache in front of a proxy allows even quicker access to data that is infront of a partition. The cache can retrieve data quickly from memory, therfore it handles multiple requests for the same results.</p><p><em>TODO: Insert image depicting using a proxy to collapse requests for data</em></p><h4>Indexes</h4><p><em>Indexes</em> allow data to be quickly accessed. It trades extra storage overhead and slower writes for faster reads. Optimizing indexes depends on the users. Creating indexes for data which is more likely to be used will allow for better system performance. Indexes are required to optimize data access for large dat sets with a small payload. It is difficult to find a small payload in a large data set, and indexes solve this problem.</p><p>Indexes can also be used like a table of contents. It could direct users to the data location. These indexes are stored in memory close to the incoming client request.</p><p>There are also often different layers of indexes that serve as a map moving people along until they reach a specific piece of data. These intermediate indexes are similar to indexes that lead to the data the user wants, however instead of containing the data location, it contains the next index or location.</p><p>Intermediate indexes and representing the data in smaller sections allows for better solutions to big data problems. Even with the data spread through the different servers, it could be easily accesed with index lookups.</p><h4>Load Balancers</h4><p>Load balancers are very critical in building a distributed system. They distribute the load across nodes responsible for servicing requests. Load balancers handle a lot of simultanious connections and route those connects to the appropriate request nodes, allowing the system to scale to services by only having to adding nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*1go_I5Q05dv0M2sdGxf6fg.png" /><figcaption>Load Balancing</figcaption></figure><p>Load balancers are an easy way to expand system capacity and play an essential role in distributed system architecture.</p><h4>Queues</h4><p>While load balancers, partitions, and indexes allow for quicker writes, they don’t address the problem of needing to read data quickly. Systems where writes or any other task may take a long time, <strong><em>queues</em></strong> are a common way to achieve better performance and availability. Having a queue allows for asynchronous transactions. They allow for tasks to be handled in the order they are received.</p><p>When a task comes in, its added to the queue and then the next avaliable service picks it up. A queue also provides protection from service outages and failures. It enforces a QoS <em>(Quality of Service)</em> which guarantees to expose clients to intermittent service outages. Queues are neccessary to handle distributed communication between the various parts of a large-scale distributed system</p><h4>Conclusion</h4><p>Designing efficient systems is very difficult. There are many factors which need to be considered. System design requires a balance between the four factors: services, redundancy, partitions, and handling failure. A system that holds a large amount of data may favor having partitions instead of providing many services. While a system that requires a large amount of user interactions may have a ton of services to process user requests. Caches, Indexes, Queues and Load Balances help to deal with the trade-offs. They balance what is traded away by providing an alternative way to deal with the system level trade-off. A lot of these factors were taken into consideration when designing various system architectures which support a large amount of websites we use today such as Facebook, and Amazon.</p><p><em>Please feel free to leave any comments, suggestions, or anything that I might have mentioned which is currently outdated. I would really like to learn from other people and appreciate anything others may say.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=412b09905d99" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scalable Web Architecture and Distributed Systems]]></title>
            <link>https://medium.com/@zuhayradibelahi/scalable-web-architecture-and-distributed-systems-b7deb0bd6597?source=rss-5ef2067bb733------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7deb0bd6597</guid>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Zuhayr Adib Elahi]]></dc:creator>
            <pubDate>Wed, 01 Jul 2015 05:56:41 GMT</pubDate>
            <atom:updated>2015-07-01T05:56:41.519Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Introduction</strong></h4><p>Recently I started to read a book called: <em>The Architecture Of Open Source Systems. </em>Overall I am really enjoying this book. It talks about a lot of different open source systems and the brains behind these systems. The first topic I would like to explore is scalable web architecture and distributed systems.</p><p>When designing large web systems and some distributed systems, there are certain building blocks that need to be taken into account. These are some of the tradeoffs that need to be taken into account when creating a large web system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*OiUZYULKhuldi1If3ryMig.jpeg" /></figure><h4>Principles of Web Distributed Systems Design</h4><p>A web site is basically a utility which allows users to connect with remote resources via the Internet. A scalable web system just means that the resources or access to the resources are distributed across multiple servers instead of just one. There are some key principles that influence the design of a large-scale web systems that are listed below:</p><ul><li><em>Availability: </em>the uptime of a website is very critical to a website’s reputation and functionality. For some companies it can really make or break them. A online retail website such as Amazon will need to constantly be running and users should always be able to access the resources and services from Amazon.</li><li><em>Performance: </em>website performance is one principle that is very important for most sites. For example, the speed and validity of the results from a search engine will dictate if users want to use this website. Creating a system that is optimized for fast responses and low latency is a key to success.</li><li><em>Reliability</em>: A system needs to be reliable. The request for data needs to be consistent. If there is a change in the data, the user needs to be know about to change.</li><li><em>Scalability</em>: This is a very broad but important aspect. It can refer to how much more storage the servers can handle or even how much more traffic the system can work with. Scalability is important to consider as it helps to understand how much traffic the website can handle and how it handles large amounts of data.</li><li><em>Manageability: </em>While designing a system, it is important to consider how the system will be managed. The operation, maintenance and update costs, as well as how easy it is to operate the system. It is important to take these factors into consideration when managing a system.</li><li><em>Cost: </em>Of course the hardware and software costs need to be considered, but there are other items which are associated with a cost. This includes what is needed to deploy and maintain the system, how many developers and training and what else needs to be used to not only develop but deploy the system.</li></ul><p>So overall it is important to consider all these factors when designing a large web application. Some of these factors might also not seem important right away, but later on will come back to haunt you. Imagine if Amazon ignored Scalability, the site would not be as it is today. It would really hurt their business. Or what if Medium did not consider Reliability. That would really hurt what we are writing on the site. Would the posts we view be what we expect?</p><p>These provide a baseline for what needs to be considered when we establish a distributed web architecture.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7deb0bd6597" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>