3 months ago
I am commiting a small amont of data and it takes forever to commit, causing my API to be slow to return a success msg. Any ideas?
32 Replies
3 months ago
By commits do you mean queries to the db? Do you have any example? Logs?
3 months ago
Does it take that long if you insert data directly from a DB Viewer such as DBeaver, Beekeeper, MySQL Workbench…
it happens seemingly randomly. I have logs below:
2025-11-24T05:46:16.313185605Z [inf] [SUBMIT] TIMING BREAKDOWN (Total: 29.326s)
2025-11-24T05:46:16.313190119Z [inf] [SUBMIT] ========================================
2025-11-24T05:46:16.313194633Z [inf] [SUBMIT] Pre-fetch job IDs : 0.0% (0.007s)
2025-11-24T05:46:16.313200834Z [inf] [SUBMIT] Get DB connection : 0.0% (0.004s)
2025-11-24T05:46:16.313205325Z [inf] [SUBMIT] Get job actions : 0.0% (0.004s)
2025-11-24T05:46:16.313209688Z [inf] [SUBMIT] Delete actions : 0.0% (0.000s)
2025-11-24T05:46:16.313213645Z [inf] [SUBMIT] Insert addon jobs : 0.0% (0.000s)
2025-11-24T05:46:16.314335834Z [inf] [SUBMIT] ========================================
2025-11-24T05:46:16.314357675Z [inf] [SUBMIT] Prepare job data : 0.0% (0.000s)
2025-11-24T05:46:16.314363163Z [inf] [SUBMIT] Mark jobs completed : 0.0% (0.010s)
2025-11-24T05:46:16.314411427Z [inf] [SUBMIT] Update addon job map : 0.0% (0.000s)
2025-11-24T05:46:16.314416570Z [inf] [SUBMIT] Insert all actions : 0.0% (0.002s)
2025-11-24T05:46:16.314421886Z [inf] [SUBMIT] Commit transaction : 99.1% (29.069s)
2025-11-24T05:46:16.314427353Z [inf] [SUBMIT] Update route timestamp : 0.7% (0.211s)
2025-11-24T05:46:16.314432748Z [inf] [SUBMIT] Other overhead : 0.1% (0.022s)
2025-11-24T05:46:16.314438029Z [inf] [SUBMIT] ========================================
3 months ago
These are logs from your API?
Its an atomic transaction. Most of the commits take 150ms but then randomly these will come by at 30s
3 months ago
I would say to check all the actions you do in this transaction and to make sure your DB and API are in the same region.
They are in the same region. I have tried several different approaches but cannot seem to solve this.
I am using a connectio pool, I have separated my transaction into read and write commitments… idk what else
3 months ago
hi hello
3 months ago
Project ID?
Im sure this is due to a bug in my code somewhere but I cant seem to find whaat the issue is beyond a slow commit…
3 months ago
going to make sure it's not a host
3 months ago
Are you part of 0xJah team? (considering your username) if not, can you open your own help thread?
3 months ago
Okay, should be okay now @0xJah
3 months ago
I don't think it was load but we've been playing whack a mole on some fraudsters
3 months ago
might take a bit to run a full investigation then
3 months ago
do you have traces with some latency times you can send over?
@angelo How can get you a trace? Is this on railway or a different method needed
3 months ago
Usually a log from mySQL stating how long the operation time took
I ended up looking into a it a bit. Is it possible its Railway's write to disk that is slow? I changed my innodbflushlogattrx_commit to 2
this seems to have it fixed. it writes a queue of commits to disk every second instead of every commit. Ill see if this fixes it long term