dawarich icon indicating copy to clipboard operation
dawarich copied to clipboard

Slow page load

Open reidprichard opened this issue 2 months ago • 20 comments

OS & Hardware Server:

  • Proxmox x86-64 VM, Fedora 41, podman-compose 1.4.1 and podman 5.5.2

Clients:

  • x86-64 PC running OpenSUSE TumbleWeed using FireFox, Zen, Chromium
  • Pixel 7 running Android 16 using FireFox, Chrome

Version 0.32.0 (behavior has been observed for many months)

Describe the bug Loading the login page is extremely slow. A fresh load (no cache) usually takes 10-15 seconds for anything to be visible, and ~30 seconds to be fully loaded. To be clear, I'm not talking about the map - simply the home page where no data is being displayed.

To Reproduce Steps to reproduce the behavior:

  1. Go to Dawarich
  2. Wait

Expected behavior It seems like the page should load in a few seconds at most.

Screenshots n/a

Logs n/a

Additional context I don't know much about web development, but perhaps the network logs from FireFox dev tools will be of use. I notice that here it seems to show much of the time is spent loading data from my local domain, but the status message in the browser indicates that a large chunk of the time is waiting on CDNs (unpkg/Cloudflare), e.g., "Transferring data from unpkg.com...".

My home network is fast fiber, but I've also tried on mobile data and on other WiFi networks.

dawarich_load_logs.har.json

reidprichard avatar Oct 04 '25 13:10 reidprichard

I can check that I have good experience with optimisation in web development assign this to me.

manshusainishab avatar Oct 05 '25 19:10 manshusainishab

Please provide logs from your dawarich_app container around time of loading any slow pages

Freika avatar Oct 07 '25 18:10 Freika

Sorry for the delay. This one was about 10 seconds from hitting 'go' to seeing anything, at which point I immediately hit the 'login' button, then a 5 second delay before the username/password fields were visible.

 User Load (0.9ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" IS NULL LIMIT $1  [["LIMIT", 1]]
  ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
{"method":"GET","path":"/api/v1/health","format":"*/*","controller":"Api::V1::HealthController","action":"index","status":200,"allocations":952,"duration":8.89,"view":0.29,"db":0.91}
  Rendering layout layouts/application.html.erb
  Rendering devise/sessions/new.html.erb within layouts/application
{"method":"GET","path":"/users/sign_in","format":"html","controller":"Devise::SessionsController","action":"new","status":200,"allocations":271614,"duration":2976.83,"view":2713.59,"db":22.24}
  Rendering layout layouts/application.html.erb
  Rendering devise/sessions/new.html.erb within layouts/application
  User Load (4.2ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" IS NULL LIMIT $1  [["LIMIT", 1]]
  ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
{"method":"GET","path":"/api/v1/health","format":"*/*","controller":"Api::V1::HealthController","action":"index","status":200,"allocations":944,"duration":99.39,"view":0.46,"db":4.14}
{"method":"GET","path":"/users/sign_in","format":"html","controller":"Devise::SessionsController","action":"new","status":200,"allocations":13549,"duration":899.88,"view":815.49,"db":0.0}

reidprichard avatar Oct 12 '25 19:10 reidprichard

Thanks.

Can you share your compose file? What are your hardware limits in your Proxmox VM?

Freika avatar Oct 13 '25 13:10 Freika

Hi @Freika , I'm currently experiencing the same issue that @reidprichard described in this thread, and I’ve opened a discussion about it as well.

I’m running everything on a Synology NAS (can’t recall the exact model at the moment), with 16GB of RAM and plenty of free resources.

I'm using the latest version of dawarich but I'm experience such page loads since I started using it months ago. Every click takes around 10 seconds or more.

Here’s my docker-compose.yaml for reference:

version: '3.8'

services:
  dawarich_redis:
    image: redis:7.4-alpine
    container_name: dawarich_redis
    command: redis-server
    restart: unless-stopped
    networks:
      - dawarich
    volumes:
      - ./redis:/var/shared/redis
    mem_limit: 1g
    healthcheck:
      test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
      interval: 10s
      retries: 5
      start_period: 30s
      timeout: 10s

  dawarich_db:
    image: postgis/postgis:17-3.5-alpine
    container_name: dawarich_db
    restart: unless-stopped
    networks:
      - dawarich
    environment:
      POSTGRES_USER: ${DATABASE_USERNAME}
      POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
      POSTGRES_DB: ${DATABASE_NAME}
    volumes:
      - ./db_data:/var/lib/postgresql/data
      - ./db_shared:/var/shared
    mem_limit: 1g
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U postgres -d dawarich_development" ]
      interval: 10s
      retries: 5
      start_period: 30s
      timeout: 10s

  dawarich_app:
    image: freikin/dawarich:latest
    container_name: dawarich_app
    stdin_open: true
    tty: true
    entrypoint: web-entrypoint.sh
    command: ['bin/rails', 'server', '-p', '3000', '-b', '::']
    restart: unless-stopped
    networks:
      - dawarich
      - photon_photonnet
    env_file:
      - .env
    environment:
      RAILS_ENV: ${RAILS_ENV}
      REDIS_URL: ${REDIS_URL}
      DATABASE_HOST: ${DATABASE_HOST}
      DATABASE_PORT: ${DATABASE_PORT}
      DATABASE_USERNAME: ${DATABASE_USERNAME}
      DATABASE_PASSWORD: ${DATABASE_PASSWORD}
      DATABASE_NAME: ${DATABASE_NAME}
      MIN_MINUTES_SPENT_IN_CITY: ${MIN_MINUTES_SPENT_IN_CITY}
      APPLICATION_HOSTS: ${APPLICATION_HOSTS}
      TIME_ZONE: ${TIME_ZONE}
      APPLICATION_PROTOCOL: ${APPLICATION_PROTOCOL}
      RAILS_LOG_TO_STDOUT: ${RAILS_LOG_TO_STDOUT}
      STORE_GEODATA: ${STORE_GEODATA}
      PHOTON_API_HOST: photon:2322
    volumes:
      - ./public:/var/app/public
      - ./watched:/var/app/tmp/imports/watched
      - ./app_storage:/var/app/storage
    ports:
      - 32568:3000
    mem_limit: 4g
    healthcheck:
      test: [ "CMD-SHELL", "wget -qO - http://127.0.0.1:3000/api/v1/health | grep -q '\"status\"\\s*:\\s*\"ok\"'" ]
      interval: 10s
      retries: 30
      start_period: 30s
      timeout: 10s
    depends_on:
      dawarich_db:
        condition: service_healthy
        restart: true
      dawarich_redis:
        condition: service_healthy
        restart: true

  dawarich_sidekiq:
    image: freikin/dawarich:latest
    container_name: dawarich_sidekiq
    stdin_open: true
    tty: true
    entrypoint: sidekiq-entrypoint.sh
    command: ['sidekiq']
    restart: unless-stopped
    networks:
      - dawarich
      - photon_photonnet
    env_file:
      - .env
    environment:
      RAILS_ENV: ${RAILS_ENV}
      REDIS_URL: ${REDIS_URL}
      DATABASE_HOST: ${DATABASE_HOST}
      DATABASE_PORT: ${DATABASE_PORT}
      DATABASE_USERNAME: ${DATABASE_USERNAME}
      DATABASE_PASSWORD: ${DATABASE_PASSWORD}
      DATABASE_NAME: ${DATABASE_NAME}
      MIN_MINUTES_SPENT_IN_CITY: ${MIN_MINUTES_SPENT_IN_CITY}
      APPLICATION_HOSTS: ${APPLICATION_HOSTS}
      TIME_ZONE: ${TIME_ZONE}
      APPLICATION_PROTOCOL: ${APPLICATION_PROTOCOL}
      RAILS_LOG_TO_STDOUT: ${RAILS_LOG_TO_STDOUT}
      STORE_GEODATA: ${STORE_GEODATA}
      PHOTON_API_HOST: photon:2322
    volumes:
      - ./public:/var/app/public
      - ./watched:/var/app/tmp/imports/watched
      - ./app_storage:/var/app/storage
    mem_limit: 4g
    healthcheck:
      test: [ "CMD-SHELL", "pgrep -f sidekiq" ]
      interval: 10s
      retries: 30
      start_period: 30s
      timeout: 10s
    depends_on:
      dawarich_db:
        condition: service_healthy
        restart: true
      dawarich_redis:
        condition: service_healthy
        restart: true
      dawarich_app:
        condition: service_healthy
        restart: true

networks:
  photon_photonnet:
    external: true
  dawarich:
    driver: bridge
    ipam:
      config:
        - subnet: 172.16.10.0/29

trmendes avatar Oct 16 '25 04:10 trmendes

The issue I've encountered is when I use the non default 3000 port for the app. I tried to set the APPLICATION_HOSTS but that didn't help.

dror3go avatar Oct 16 '25 07:10 dror3go

Not able to get my compose at the moment, but I can confirm I'm using a different port. I'll try switching back to 3000 when I can.

reidprichard avatar Oct 16 '25 12:10 reidprichard

Switching port didn't seem to make a difference, but I went through my compose file and noticed the dawarich_app resource limits:

    deploy:
      resources:
        limits:
          cpus: '0.50'    # Limit CPU usage to 50% of one core
          memory: '4G'    # Limit memory usage to 4GB

Removing the CPU limit dropped the load time from ~10s to ~5s; removing the memory limit dropped it from ~5s to ~3s. Probably should have started there. Perhaps the default resource limits need to be bumped up?

For what it's worth, here's my full config.

networks:
  dawarich:
services:
  dawarich_redis:
    image: docker.io/redis:7.4-alpine
    container_name: dawarich_redis
    command: redis-server
    networks:
      - dawarich
    volumes:
      - shared_data:/data
    restart: always
    healthcheck:
      test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
      interval: 10s
      retries: 5
      start_period: 30s
      timeout: 10s
  dawarich_db:
    image: docker.io/postgis/postgis:17-3.5-alpine
    shm_size: 1G
    container_name: dawarich_db
    volumes:
      - db_data:/var/lib/postgresql/data
      - shared_data:/var/shared
    networks:
      - dawarich
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: password
      POSTGRES_DB: dawarich_development
    restart: always
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U postgres -d dawarich_development" ]
      interval: 10s
      retries: 5
      start_period: 30s
      timeout: 10s
    # command: postgres -c config_file=/etc/postgresql/postgresql.conf # Use custom config
  dawarich_app:
    image: docker.io/freikin/dawarich:0.32.0
    container_name: dawarich_app
    volumes:
      - public:/var/app/public
      - watched:/var/app/tmp/imports/watched
      - storage:/var/app/storage
      - db_data:/dawarich_db_data
    networks:
      - dawarich
    ports:
      - 3003:3000
      # - 9394:9394 # Prometheus exporter, uncomment if needed
    stdin_open: true
    tty: true
    entrypoint: web-entrypoint.sh
    command: ['bin/rails', 'server', '-p', '3000', '-b', '::']
    restart: on-failure
    environment:
      RAILS_ENV: development
      RAILS_MAX_THREADS: 10
      REDIS_URL: redis://dawarich_redis:6379
      DATABASE_HOST: dawarich_db
      DATABASE_USERNAME: postgres
      DATABASE_PASSWORD: password
      DATABASE_NAME: dawarich_development
      MIN_MINUTES_SPENT_IN_CITY: 60
      APPLICATION_HOSTS: "example.local"
      TIME_ZONE: US/Eastern
      APPLICATION_PROTOCOL: http
      DISTANCE_UNIT: mi
      PROMETHEUS_EXPORTER_ENABLED: false
      # PROMETHEUS_EXPORTER_HOST: 0.0.0.0
      # PROMETHEUS_EXPORTER_PORT: 9394
      PHOTON_API_HOST: "localhost:2322"
      PHOTON_API_USE_HTTPS: false
      SELF_HOSTED: "true"
      #STORE_GEODATA: "true"
    logging:
      driver: "json-file"
      options:
        max-size: "100m"
        max-file: "5"
    healthcheck:
      test: [ "CMD-SHELL", "wget -qO - http://127.0.0.1:3000/api/v1/health | grep -q '\"status\"\\s*:\\s*\"ok\"'" ]
      interval: 10s
      retries: 30
      start_period: 30s
      timeout: 10s
    depends_on:
      dawarich_db:
        condition: service_healthy
        restart: true
      dawarich_redis:
        condition: service_healthy
        restart: true
    # deploy:
    #   resources:
    #     limits:
    #       cpus: '0.5'       # Limit CPU usage to 50% of one core
    #       memory: '4G'    # Limit memory usage to 4GB
  dawarich_sidekiq:
    image: docker.io/freikin/dawarich:latest
    container_name: dawarich_sidekiq
    volumes:
      - public:/var/app/public
      - watched:/var/app/tmp/imports/watched
      - storage:/var/app/storage
    networks:
      - dawarich
    stdin_open: true
    tty: true
    entrypoint: sidekiq-entrypoint.sh
    command: ['sidekiq']
    restart: on-failure
    environment:
      RAILS_ENV: development
      REDIS_URL: redis://dawarich_redis:6379
      DATABASE_HOST: dawarich_db
      DATABASE_USERNAME: postgres
      DATABASE_PASSWORD: password
      DATABASE_NAME: dawarich_development
      APPLICATION_HOSTS: localhost
      BACKGROUND_PROCESSING_CONCURRENCY: 10
      APPLICATION_PROTOCOL: http
      DISTANCE_UNIT: mi
      PROMETHEUS_EXPORTER_ENABLED: false
      PROMETHEUS_EXPORTER_HOST: dawarich_app
      PROMETHEUS_EXPORTER_PORT: 9394
      PHOTON_API_HOST: "172.20.11.12:2322"
      PHOTON_API_USE_HTTPS: false
      SELF_HOSTED: "true"
    logging:
      driver: "json-file"
      options:
        max-size: "100m"
        max-file: "5"
    healthcheck:
      test: [ "CMD-SHELL", "pgrep -f sidekiq" ]
      interval: 10s
      retries: 30
      start_period: 30s
      timeout: 10s
    depends_on:
      dawarich_db:
        condition: service_healthy
        restart: true
      dawarich_redis:
        condition: service_healthy
        restart: true
      dawarich_app:
        condition: service_healthy
        restart: true
    deploy:
      resources:
        limits:
          cpus: '1'    # Limit CPU usage to 100% of one core
          memory: '4G'    # Limit memory usage to 4GB

volumes:
  db_data:
  shared_data:
  public:
  watched:
  storage:

reidprichard avatar Oct 16 '25 23:10 reidprichard

I have found the issue. My firewall was blocking external access to dawarich. It got so much better and faster after I add new rules to allow access to port 53,80,443. Does it make sense?

trmendes avatar Oct 23 '25 05:10 trmendes

Commenting the cpus: '0.50' in the compose file fixed my slowdowns. Previously it was taking 2-6 seconds to load a page now it's instant for everything.

verm avatar Oct 31 '25 01:10 verm

I’m experiencing the same issue. I don’t have any resource limits configured in my Docker Compose setup. After importing around 60,000 points, the site becomes very slow to load. The background jobs for reverse geocoding have finished, and I’ve already rebooted the machine. I’m running Debian Trixie with Docker.

Page loading times are approximately 10 seconds, both with and without a reverse proxy.

My browser console Log: rails-ujs-7910fbc642fb718c5e4cfb389a32582be19f6d5dc242d30a330fd0552b0030a8.js:565 Uncaught Error: rails-ujs has already been loaded! at Object.start (rails-ujs-7910fbc642fb718c5e4cfb389a32582be19f6d5dc242d30a330fd0552b0030a8.js:565:13) at application-1f97ab1cc22cdc5a42fe5224cec495bc5d3eb551e2fdd291a391a58b2dd7ef9f.js:17:7 start @ rails-ujs-7910fbc642fb718c5e4cfb389a32582be19f6d5dc242d30a330fd0552b0030a8.js:565 (anonymous) @ application-1f97ab1cc22cdc5a42fe5224cec495bc5d3eb551e2fdd291a391a58b2dd7ef9f.js:17Understand this error 2content.js:1 Uncaught (in promise) The message port closed before a response was received. (anonymous) @ content.js:1Understand this error trips_controller-bf8df073f6834f07879b40d366cc527f295a191e3d373a9697b24a8630a464ea.js:22 Trips controller connected site.webmanifest:1 GET https://dawarich..../site.webmanifest 404 (Not Found)Understand this error 1:1 Manifest fetch from https://dawarich...../site.webmanifest failed, code 404

SandraCHC avatar Nov 10 '25 09:11 SandraCHC

My instance is crashing whenever I zoom out of the map to 5 miles and then zoom back in. I'm running 0.35.1 ...

My logs show from refresh, to zooming out, the crash, then hitting exit page and finally refresh to view again.

Image

The allocations seem very high ... here's an example of one ... {"method":"GET","path":"/api/v1/countries/borders.json","format":"json","controller":"Api::V1::Countries::BordersController","action":"index","status":200,"allocations":2137228,"duration":8536.41,"view":2717.62,"db":8.01}

Here's a full log ..

  User Load (4.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
  ↳ app/controllers/application_controller.rb:13:in 'ApplicationController#unread_notifications'
  User Load (6.9ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
  ↳ app/controllers/application_controller.rb:13:in 'ApplicationController#unread_notifications'
  User Load (74.2ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" = $1 LIMIT $2  [["api_key", "[FILTERED]"], ["LIMIT", 1]]
  ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
  User Load (44.3ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" = $1 LIMIT $2  [["api_key", "[FILTERED]"], ["LIMIT", 1]]
  ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
  Area Load (174.3ms)  SELECT "areas".* FROM "areas" WHERE "areas"."user_id" = $1  [["user_id", 1]]
  ↳ app/controllers/api/v1/areas_controller.rb:9:in 'Api::V1::AreasController#index'
{"method":"GET","path":"/api/v1/areas","format":"*/*","controller":"Api::V1::AreasController","action":"index","status":200,"allocations":3835,"duration":327.79,"view":22.84,"db":225.47}
{"method":"GET","path":"/api/v1/countries/borders.json","format":"json","controller":"Api::V1::Countries::BordersController","action":"index","status":200,"allocations":1976314,"duration":6233.28,"view":1601.41,"db":78.42}
  User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" IS NULL LIMIT $1  [["LIMIT", 1]]
  ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
{"method":"GET","path":"/api/v1/health","format":"*/*","controller":"Api::V1::HealthController","action":"index","status":200,"allocations":985,"duration":2.25,"view":0.09,"db":0.24}
  User Load (0.5ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" = $1 LIMIT $2  [["api_key", "[FILTERED]"], ["LIMIT", 1]]
  ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
  Stat Sum (0.4ms)  SELECT SUM("stats"."distance") FROM "stats" WHERE "stats"."user_id" = $1  [["user_id", 1]]
  ↳ app/serializers/stats_serializer.rb:24:in 'StatsSerializer#total_distance_km'
  Point Count (2881.1ms)  SELECT COUNT(*) FROM "points" WHERE "points"."user_id" = $1 AND "points"."reverse_geocoded_at" IS NOT NULL  [["user_id", 1]]
  ↳ app/serializers/stats_serializer.rb:30:in 'StatsSerializer#reverse_geocoded_points'
  Stat Load (14.4ms)  SELECT "stats".* FROM "stats" WHERE "stats"."user_id" = $1  [["user_id", 1]]
  ↳ app/serializers/stats_serializer.rb:34:in 'Enumerable#group_by'
{"method":"GET","path":"/api/v1/stats","format":"json","controller":"Api::V1::StatsController","action":"index","status":200,"allocations":140762,"duration":3124.93,"view":0.12,"db":2896.31}
  User Load (0.7ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" IS NULL LIMIT $1  [["LIMIT", 1]]
  ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
{"method":"GET","path":"/api/v1/health","format":"*/*","controller":"Api::V1::HealthController","action":"index","status":200,"allocations":985,"duration":65.24,"view":0.28,"db":0.63}
  User Load (1.6ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" IS NULL LIMIT $1  [["LIMIT", 1]]
  ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
{"method":"GET","path":"/api/v1/health","format":"*/*","controller":"Api::V1::HealthController","action":"index","status":200,"allocations":985,"duration":9.54,"view":0.24,"db":1.56}
  User Load (0.9ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" IS NULL LIMIT $1  [["LIMIT", 1]]
  ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
{"method":"GET","path":"/api/v1/health","format":"*/*","controller":"Api::V1::HealthController","action":"index","status":200,"allocations":985,"duration":6.59,"view":0.21,"db":0.85}
  User Load (0.9ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" IS NULL LIMIT $1  [["LIMIT", 1]]
  ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
{"method":"GET","path":"/api/v1/health","format":"*/*","controller":"Api::V1::HealthController","action":"index","status":200,"allocations":985,"duration":10.92,"view":0.17,"db":0.89}
  User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" IS NULL LIMIT $1  [["LIMIT", 1]]
  ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
{"method":"GET","path":"/api/v1/health","format":"*/*","controller":"Api::V1::HealthController","action":"index","status":200,"allocations":985,"duration":2.31,"view":0.07,"db":0.24}
  User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" IS NULL LIMIT $1  [["LIMIT", 1]]
  ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
{"method":"GET","path":"/api/v1/health","format":"*/*","controller":"Api::V1::HealthController","action":"index","status":200,"allocations":985,"duration":3.1,"view":0.08,"db":0.25}
{"method":null,"path":null,"format":null,"params":null,"controller":"NotificationsChannel","action":"unsubscribe","status":200,"allocations":21,"duration":0.1}
{"method":null,"path":null,"format":null,"params":null,"controller":"PointsChannel","action":"unsubscribe","status":200,"allocations":21,"duration":0.12}
{"method":null,"path":null,"format":null,"params":null,"controller":"ImportsChannel","action":"unsubscribe","status":200,"allocations":34,"duration":0.21}
{"method":null,"path":null,"format":null,"params":null,"controller":"TracksChannel","action":"unsubscribe","status":200,"allocations":34,"duration":0.13}
{"method":null,"path":null,"format":null,"params":{},"controller":"ApplicationCable::Connection","action":"disconnect","status":200,"allocations":270,"duration":1.93}
  User Load (0.7ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" = $1 LIMIT $2  [["api_key", "[FILTERED]"], ["LIMIT", 1]]
  ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
  Stat Sum (0.6ms)  SELECT SUM("stats"."distance") FROM "stats" WHERE "stats"."user_id" = $1  [["user_id", 1]]
  ↳ app/serializers/stats_serializer.rb:24:in 'StatsSerializer#total_distance_km'
  User Load (127.5ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" IS NULL LIMIT $1  [["LIMIT", 1]]
  ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
{"method":"GET","path":"/api/v1/health","format":"*/*","controller":"Api::V1::HealthController","action":"index","status":200,"allocations":4238,"duration":149.67,"view":0.37,"db":196.43}
  Point Count (4241.2ms)  SELECT COUNT(*) FROM "points" WHERE "points"."user_id" = $1 AND "points"."reverse_geocoded_at" IS NOT NULL  [["user_id", 1]]
  ↳ app/serializers/stats_serializer.rb:30:in 'StatsSerializer#reverse_geocoded_points'
  Stat Load (6.5ms)  SELECT "stats".* FROM "stats" WHERE "stats"."user_id" = $1  [["user_id", 1]]
  ↳ app/serializers/stats_serializer.rb:34:in 'Enumerable#group_by'
{"method":"GET","path":"/api/v1/stats","format":"json","controller":"Api::V1::StatsController","action":"index","status":200,"allocations":147284,"duration":4354.09,"view":0.1,"db":4248.81}
  User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
  ↳ app/controllers/application_controller.rb:13:in 'ApplicationController#unread_notifications'
  Point Pluck (0.7ms)  SELECT "points"."lonlat", "points"."battery", "points"."altitude", "points"."timestamp", "points"."velocity", "points"."id", "points"."country_name", "points"."track_id" FROM "points" WHERE "points"."user_id" = $1 AND (timestamp >= $2 AND timestamp <= $3) ORDER BY "points"."timestamp" ASC  [["user_id", 1], [nil, 1762732800], [nil, 1762819199]]
  ↳ app/controllers/map_controller.rb:26:in 'MapController#build_coordinates'
  Track Load (1.1ms)  SELECT "tracks".* FROM "tracks" WHERE "tracks"."user_id" = $1 AND "tracks"."id" IN ($2, $3, $4, $5) ORDER BY "tracks"."start_at" ASC  [["user_id", 1], ["id", 48845], ["id", 48846], ["id", 48847], ["id", 48848]]
  ↳ app/serializers/tracks_serializer.rb:16:in 'Enumerable#map'
  Rendering layout layouts/map.html.erb
  Rendering map/index.html.erb within layouts/map
  Notification Load (0.3ms)  SELECT "notifications".* FROM "notifications" WHERE "notifications"."user_id" = $1 AND "notifications"."read_at" IS NULL ORDER BY "notifications"."created_at" DESC  [["user_id", 1]]
  ↳ app/views/shared/_navbar.html.erb:137
{"method":"GET","path":"/map","format":"html","controller":"MapController","action":"index","status":200,"allocations":91122,"duration":123.34,"view":112.85,"db":2.37}
  User Load (0.6ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
  ↳ app/channels/application_cable/connection.rb:14:in 'ApplicationCable::Connection#find_verified_user'
{"method":null,"path":null,"format":null,"params":{},"controller":"ApplicationCable::Connection","action":"connect","status":200,"allocations":998,"duration":5.28}
{"method":null,"path":null,"format":null,"params":null,"controller":"NotificationsChannel","action":"subscribe","status":200,"allocations":102,"duration":0.27}
{"method":null,"path":null,"format":null,"params":null,"controller":"PointsChannel","action":"subscribe","status":200,"allocations":103,"duration":0.23}
{"method":null,"path":null,"format":null,"params":null,"controller":"ImportsChannel","action":"subscribe","status":200,"allocations":119,"duration":0.36}

ActionController::RoutingError (No route matches [GET] "/site.webmanifest"):

{"method":null,"path":null,"format":null,"params":null,"controller":"TracksChannel","action":"subscribe","status":200,"allocations":103,"duration":0.25}

elyobelyob avatar Nov 10 '25 13:11 elyobelyob

My instance is crashing whenever I zoom out of the map to 5 miles and then zoom back in. I'm running 0.35.1 ...

I can confirm this, but it happens sporadically and not directly when zooming.

SandraCHC avatar Nov 10 '25 14:11 SandraCHC

I've just set up Dawarich and it's unusably slow for me.

Using the default Compose file, just with the limits removed as suggested above, on a Proxmox VM with 4 cores and 6GB of RAM. The login page takes several minutes to load, I have eventually got logged in and then trying to do anything, such as importing data, is also taking minutes.

The VM is in a VLAN with no internet connectivity, could that have an effect? EDIT: I can confirm this is the issue. When I allow that VM internet access again, everything is instant. Something must be attempting to call home and timing out - is running Dawarich offline not supported then? 2nd EDIT: I've taken the VM back offline again, and everything is still instant! Almost like it needed a one-time internet connection?

(Apologies if this is a red herring, but I wanted to get all information documented.)

Logs from the dawarich_app container:

dawarich_app      | {"method":"GET","path":"/exports","format":"html","controller":"ExportsController","action":"index","status":200,"allocations":153158,"duration":120138.83,"view":120110.67,"db":7.64}
dawarich_app      |   User Load (0.1ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" IS NULL LIMIT $1  [["LIMIT", 1]]
dawarich_app      |   ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
dawarich_app      | {"method":"GET","path":"/api/v1/health","format":"*/*","controller":"Api::V1::HealthController","action":"index","status":200,"allocations":992,"duration":1.48,"view":0.12,"db":0.14}
dawarich_app      |   User Load (0.1ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" IS NULL LIMIT $1  [["LIMIT", 1]]
dawarich_app      |   ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
dawarich_app      | {"method":"GET","path":"/api/v1/health","format":"*/*","controller":"Api::V1::HealthController","action":"index","status":200,"allocations":992,"duration":1.46,"view":0.09,"db":0.14}
dawarich_app      |   User Load (0.4ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
dawarich_app      |   ↳ app/controllers/application_controller.rb:13:in 'ApplicationController#unread_notifications'
dawarich_app      |   Rendering layout layouts/application.html.erb
dawarich_app      |   Rendering imports/new.html.erb within layouts/application
dawarich_app      |   Import Count (0.3ms)  SELECT COUNT(*) FROM "imports" WHERE "imports"."user_id" = $1  [["user_id", 1]]
dawarich_app      |   ↳ app/views/imports/_form.html.erb:28
dawarich_app      |   Family::Membership Load (0.1ms)  SELECT "family_memberships".* FROM "family_memberships" WHERE "family_memberships"."user_id" = $1 LIMIT $2  [["user_id", 1], ["LIMIT", 1]]
dawarich_app      |   ↳ app/models/concerns/user_family.rb:17:in 'UserFamily#in_family?'
dawarich_app      |   User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
dawarich_app      |   ↳ app/controllers/application_controller.rb:13:in 'ApplicationController#unread_notifications'
dawarich_app      |   Rendering layout layouts/application.html.erb
dawarich_app      |   Rendering imports/new.html.erb within layouts/application
dawarich_app      |   Import Count (0.5ms)  SELECT COUNT(*) FROM "imports" WHERE "imports"."user_id" = $1  [["user_id", 1]]
dawarich_app      |   ↳ app/views/imports/_form.html.erb:28
dawarich_app      |   Family::Membership Load (0.1ms)  SELECT "family_memberships".* FROM "family_memberships" WHERE "family_memberships"."user_id" = $1 LIMIT $2  [["user_id", 1], ["LIMIT", 1]]
dawarich_app      |   ↳ app/models/concerns/user_family.rb:17:in 'UserFamily#in_family?'
dawarich_app      |   User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."api_key" IS NULL LIMIT $1  [["LIMIT", 1]]
dawarich_app      |   ↳ app/controllers/api_controller.rb:30:in 'ApiController#current_api_user'
dawarich_app      | {"method":"GET","path":"/api/v1/health","format":"*/*","controller":"Api::V1::HealthController","action":"index","status":200,"allocations":994,"duration":2.47,"view":0.17,"db":0.16}

mattholland0202 avatar Nov 23 '25 21:11 mattholland0202

@mattholland0202 yes, give it access to the web and see if it helped

Freika avatar Nov 23 '25 22:11 Freika

@Freika I can confirm that giving the VM internet connectivity makes everything load instantly, and the application is now fully working. Even when I then disable it again, everything is still instant. Is there some kind of initial thing that needs to call home once?

mattholland0202 avatar Nov 23 '25 22:11 mattholland0202

@Freika And now, having left the VM offline since my last comment, everything was fully unresponsive again. Re-enabling WAN connectivity again made everything instant, so this is definitely the reason.

Is it expected that running Dawarich offline isn't supported please?

mattholland0202 avatar Nov 24 '25 17:11 mattholland0202

@mattholland0202 there are a few libraries that are being loaded from CDN, I think it's the reason: https://github.com/Freika/dawarich/blob/master/app/views/layouts/application.html.erb

So yes, you need your VM to have the connection. It may change in the future and Dawarich will be working offline, but no estimates as it's not a priority

Freika avatar Nov 24 '25 17:11 Freika

@Freika Thanks for letting me know. Would I be able to raise a feature request somewhere please, even if it just goes into your backlog? Is starting a discussion the best place to do this?

mattholland0202 avatar Nov 24 '25 21:11 mattholland0202

Yup, discussions is the place

Freika avatar Nov 24 '25 22:11 Freika