Finding query bottlenecks - Deepstash
Finding query bottlenecks

Finding query bottlenecks

Review your API endpoints and views for:

  • Duplicate queries
  • Slow queries
  • ORM calls that resolve more queries than you expect

STASHED IN:

2

📖 Two Scoops of Django

STASHED IN:

0 Comments

MORE IDEAS FROM Speed up query-heavy requests

Tips to reduce query bottlenecks
  1. Reduce number of queries
  2. Speed up common queries
  3. Cache results of heavy queries
  4. Turn off ATOMIC_REQUESTS -- This settings makes all queries run in a transaction. Read Django docs before changing it to understand the trade-offs.
  5. Tune database settings

STASHED IN:

2

Reduce number of queries
  • Use select_related() to retrieve Foreign Key relations in the same query.
  • Use prefetch_related() for many-to-many and many-to-one relations.
  • Re-use query results across the lifetime of the request if you need them in more places.

STASHED IN:

2

Speed up common queries
  • Add indexes on fields you frequently filter/sort on.
  • Analyze query plans generated by common queries and identify bottlenecks.
  • Rewrite queries to return smaller results sets when possible.
  • Re-model data in a way that allows indexes to work more efficiently.
  • As a last resort, use raw SQL when you can't generate an efficient query through the ORM.

STASHED IN:

2

Deepstash helps you become inspired, wiser and productive, through bite-sized ideas from the best articles, books and videos out there.

GET THE APP:

RELATED IDEA

Page speed could improve ranking

A website owner can spread their marketing dollars further by prioritising SEO. Some parts of the SEO strategy and implementation can take months, but others can be implemented in a few hours.

The easiest SEO improvement is page speed. Google considers the load time in its ranking, meaning that a faster load time for a website to display could benefit its ranking.

STASHED IN:

2

What Is Docker?

Docker is an open source containerization toolkit which enables developers to package applications into containers.

As the name suggests, Docker is like a container ship which provides means to sort, link, manage and ship containers from a development setup into production.

STASHED IN:

6

Docker is a very powerful tool for development and code deployment. This is what you’re missing to take it to the next level!

📖 Research

STASHED IN:

0 Comments

What is Docker Swarm and why You Need to Start using it

It’s a cluster comprised of a group of physical and virtual machines running the Docker Engine, these are called nodes.

One of the nodes is elected to be the Leader by using the Raft consensus algorithm. He make all the orchestration decisions for the swarm. In case of failure, a new leader it’s automatically elected.

Manager nodes assign tasks to Worker nodes. They can do some other managerial tasks. You want to have an odd number of managers, for reliability purposes. Having to many managers can degrade performance, it’s recommended to have at most 7.

1

STASHED IN:

1

So you started development using a Docker architecture but you don’t know how to scale and deploy?

STASHED IN:

0 Comments