@anze3db@fosstodon.org
@anze3db@fosstodon.org avatar

anze3db

@anze3db@fosstodon.org

Writing Python :python:, Django :django: and surfing waves 🏄‍♂️

Projects:
🧪 https://flakytest.dev tame your test suite flakiness
🧑‍💻 https://fedidevs.com find awesome devs across the fediverse
💻 https://github.com/anze3db/django-tui a TUI for all your Django commands

This profile is from a federated server and may be incomplete. Browse more on the original instance.

anze3db, to random
@anze3db@fosstodon.org avatar

No more pagination on fedidevs.com! The accounts are now lazy loaded 💫

video/mp4

anze3db, to random
@anze3db@fosstodon.org avatar
anze3db, to random
@anze3db@fosstodon.org avatar

Sprinting !

hynek, to random
@hynek@mastodon.social avatar

There is something deeply primal and human about staring into a fire, at night, with dogs and red wine, on a beach you surfed earlier. It’s been too long.

anze3db,
@anze3db@fosstodon.org avatar

@hynek this looks awesome, but how good were the waves?

anze3db, to random
@anze3db@fosstodon.org avatar

I'm really excited to be giving a talk about SQLite in production at #DjangoConEurope today!

https://pretalx.evolutio.pt/djangocon-europe-2024/talk/EGHBKP/

anze3db,
@anze3db@fosstodon.org avatar

@e11bits @djangoconeurope I believe the talk will be posted on the djangon youtube channel at some point https://youtube.com/

anze3db, to random
@anze3db@fosstodon.org avatar
anze3db, to random
@anze3db@fosstodon.org avatar

I've just pushed a small change for fedidevs! Conference posts are now sorted by creation date while the conference is live!

I've found myself switching the sorting all the time while at which means the default was bad 😅

https://fedidevs.com/djangoconeu24/

anze3db, to random
@anze3db@fosstodon.org avatar

@carlton telling us about how we we maybe don’t need APIs.

“Django works great when money is tight!”

image/jpeg

anze3db, to random
@anze3db@fosstodon.org avatar

Ups and downs of using Django with HTMX.

anze3db,
@anze3db@fosstodon.org avatar

Wins

anze3db,
@anze3db@fosstodon.org avatar

Struggles

image/jpeg

anze3db, to random
@anze3db@fosstodon.org avatar

💖 I'm sponsoring DjangoGirls because they are doing really amazing work (and it’s their 10 year anniversary!)

https://github.com/sponsors/DjangoGirls

anze3db, to random
@anze3db@fosstodon.org avatar

Made it to

anze3db, to PostgreSQL
@anze3db@fosstodon.org avatar

Mystery solved! The problem was that requests were creating new db connections which is super expensive.

Adding POOL to the database OPTIONS (added in Django 5.1a1) solves this problem and brings throughput on par with SQLite 🎉

https://docs.djangoproject.com/en/dev/releases/5.1/#postgresql-connection-pools
https://fosstodon.org/@anze3db/112557766800166792

anze3db, to random
@anze3db@fosstodon.org avatar

Trains really are the best way to travel. I'm working on my laptop with loads of legroom, good wifi, comfortable seat, while the train speeds through the countryside at 200+km/h!

anze3db, to random
@anze3db@fosstodon.org avatar

On the train to Porto and then Vigo (if I don't miss the connection 🤞).

here I come!

anze3db, to random
@anze3db@fosstodon.org avatar

Any idea why PostgreSQL is this much slower compared to SQLite and MySQL?

This is on Ubuntu 24.04, connecting through Django and I've tried both psycopg and psycopg2, but the result is the same: ~200 requests per second with Postgres compared to ~2000 with SQLite or MySQL.

anze3db,
@anze3db@fosstodon.org avatar

@frank I have CONN_MAX_AGE set to None which should give me unlimited persistent connections. Will try out with 60 as well later today just in case, thanks!

anze3db,
@anze3db@fosstodon.org avatar

@mistersql that's what it looks like. I have CONN_MAX_AGE set to None so connections should be persistent, but I'll dig around this a bit more after work today.

anze3db,
@anze3db@fosstodon.org avatar

@hynek @frank I don't think that's the case here. The query is a simple select * from table limit 10;

I think it has to be a postgres configuration issue or a problem with the way Django does connection pooling.

anze3db,
@anze3db@fosstodon.org avatar

@hynek @frank The technology just isn't there yet for us to be able to see what's going on inside a Python process 🙃

anze3db,
@anze3db@fosstodon.org avatar

@frank @hynek know, I have CONN_MAX_AGE set to None so the connections should persist between requests.

https://docs.djangoproject.com/en/5.0/ref/databases/#persistent-connections

anze3db,
@anze3db@fosstodon.org avatar

@pbx no, I'm only changing the DATABASE variable in Django's settings.py so everything should be exactly the same.

anze3db,
@anze3db@fosstodon.org avatar

@frank ok, looks like CONN_MAX_AGE doesn't do connection pooling at all, but using the POOL option added to Django 5.1a1 got my throughput in Postgres on par with SQLIte 🎉

anze3db, (edited )
@anze3db@fosstodon.org avatar

@adamchainz @frank I had the settings in DATABASE[“OPTIONS”] 🤦‍♂️

I have just confirmed that it works as expected if you actually configure it properly!

Thanks! 🙏

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • ngwrru68w68
  • everett
  • InstantRegret
  • magazineikmin
  • thenastyranch
  • rosin
  • GTA5RPClips
  • Durango
  • Youngstown
  • slotface
  • khanakhh
  • kavyap
  • DreamBathrooms
  • megavids
  • cubers
  • ethstaker
  • osvaldo12
  • modclub
  • cisconetworking
  • mdbf
  • tester
  • tacticalgear
  • Leos
  • normalnudes
  • provamag3
  • anitta
  • lostlight
  • All magazines