directus / v8-archive

Directus Database API — Wraps Custom SQL Databases with a REST/GraphQL API
https://docs.directus.io/api/reference.html
507 stars 204 forks source link

Performance - Response times #1743

Open cupcakearmy opened 4 years ago

cupcakearmy commented 4 years ago

Issue

So the issue is that the api takes really long time to respond to even the simplest requests. I can range from ~150ms in the best cases to even almost a whole second. Basically this makes directus impossible to use in server side rendering. Is there any way to speed up calls? I have not found anything about it in the docs.

Model

The model is really simple. It is a sorted model with just 2 text fields. So nothing complicated

Pics (~700ms & ~200ms)

Screenshot 2020-02-07 at 16 16 28 Screenshot 2020-02-07 at 16 16 48

Versions

Pulled the latest image before creating the issue

nachogarcia commented 4 years ago

Do you have cache enabled?

Also, we're caching everything on top of it with cloudflare.

cupcakearmy commented 4 years ago

I've enabled it, not it takes "only" ~130ms. There is not way to get that faster I guess then.

For reference:

docker-compose.yml
version: '3.7'

services:
  mysql:
    image: mysql:5.7
    env_file: .env
    volumes:
      - ./data/db:/var/lib/mysql

  directus:
    image: directus/directus:v8-apache
    env_file: .env
    ports:
      - 80:80
    volumes:
      - ./data/config:/var/directus/config
      - ./data/uploads:/var/directus/public/uploads
.env
MYSQL_DATABASE=directus
MYSQL_USER=directus
MYSQL_PASSWORD=xxx
MYSQL_RANDOM_ROOT_PASSWORD=yes

DIRECTUS_ENV=production
DIRECTUS_CACHE_ENABLED=true
DIRECTUS_CACHE_RESPONSETTL=3600
DIRECTUS_AUTH_PUBLICKEY=xxx
DIRECTUS_AUTH_SECRETKEY=xxx
DIRECTUS_DATABASE_HOST=mysql
DIRECTUS_DATABASE_PORT=3306
DIRECTUS_DATABASE_NAME=directus
DIRECTUS_DATABASE_USERNAME=directus
DIRECTUS_DATABASE_PASSWORD=xxx