How Instagram Is Using Django And Python

“How Instagram Is Using Django And Python”- Instagram has become everyone’s favorite social media channel. You can see a seamless number of posts and profiles and can be chit chatted at one place.

Image result for how instagram is using Django and python
Instagram

However, let’s now look into what is behind the scenes in the making of Instagram. This post will learn how our Python and Django framework plays a role in making such a powerful tool.

Instagram was developed in San Francisco by Kevin Systrom and Mike Krieger. Systrom was working in marketing and started doing engineering at night to learn how to code. He created a prototype app of an idea he originally called Burbn, which allowed people to check-in where they are on their mobile web app.

What is Django?

Django is a free and open-source web application framework written in Python. A web framework is a set of components that help you develop websites faster and easier.

When you’re building a website, you always need a similar set of components: a way to handle user authentication (signing up, signing in, signing out), a management panel for your website, forms, a way to upload files, etc.

Let’s now look into how Instagram uses these Python frameworks.

Use of Python Frameworks in Instagram:

Instagram utilizes Django, which is a Python web structure. It is the best structure you can learn. As a designer, if the venture is created by one group from the earliest starting point, you can, without much of a stretch, change it anyplace in the center. In truth, Django is a unique open-source structure composed of Python language used to develop web applications.

Django has made it simpler for designers to assemble plenty of web applications, website pages, and web administrations. Instagram began in 2010 and a couple of months after the fact they had 1 million clients. As a matter of fact, Django was an ultimately advantageous arrangement to manufacture Instagram in it.

  • Django is designed to help the developers make an application as quickly as possible.
  • For error reporting on Instagram, Sentry is used, which is an open-source Django app written by the team at Disqus. Django ORM manages a database of 5 million users in the year 2010.
  • Django is the core of Instagram.
  • Although a massive 5 million users managed by Django ORM, Instagram starts quickly because it uses Django integrated services.
  • The ORM can be replaced if Django is loosely coupled enough. The fun fact is that all Instagram and Facebook employees can contribute code to Django.
  • The whole of this fantastic platform is written entirely in Python. To be precise, Instagram features the world’s largest deployment of the Django web framework.

The following are official data provided by Instagram regarding their use of Python. 

1- Thrash and Data Management :

At Instagram, they have the world’s largest deployment of the Django web framework, written entirely in Python. They began using Python early on because of its simplicity but had to do many hacks over the years to keep it simple as we’ve scaled. Last year developers tried dismissing the Python garbage collection (GC) mechanism (which reclaims memory by collecting and freeing unused data) and gained 10% more capacity. However, as the engineering team and number of features have continued to grow, so has memory usage. Eventually, they started losing the gains they had achieved by disabling GC.

Here’s a graph that shows how memory grew with the number of requests. After 3,000 requests, the process used ~600MB more memory. More importantly, the trend was linear.

memory grew with the number of requests

From load test, it could be seen that memory usage was becoming bottleneck. Enabling GC could alleviate this problem and slow down the memory growth, but undesired Copy-on-write (COW) would still increase the overall memory footprint. So they decided to see if hey could make Python GC work without COW, and hence, the memory overhead.

From the load test, it could be seen that memory usage was becoming a bottleneck. Enabling GC could alleviate this problem and slow down the memory growth, but undesired Copy-on-write (COW) would still increase the overall memory footprint. So they decided to see if they could make Python GC work without COW, and hence, the memory overhead.

2- Web service efficiency :

Instagram currently features the world’s largest deployment of the Django web framework, written entirely in Python. We initially chose to use Python because of its reputation for simplicity and practicality, which aligns well with our philosophy of “do the simple thing first.” But clarity can come with a tradeoff efficiency. Instagram has doubled in size over the last two years and recently crossed 500 million users, so there is a strong need to maximize web service efficiency so that our platform can continue to scale smoothly. In the past year, we’ve made our efficiency program a priority, and over the last six months, we’ve been able to maintain our user growth without adding new capacity to our Django tiers. This post will share some of the tools we built and how we use them to optimize our daily deployment flow.

So, The above are some of Python’s uses in Instagram, the powerful tool built in Python.

Must Read

Best Ways to Normalize Numpy Array
6 Ways to Plot a Circle in Matplotlib
7 Ways in Python to Capitalize First Letter of a String

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments