Is anyone else experiencing slow commits to their MySql DB? I am randomly getting 30s+ DB commits.
joelahilliard
PROOP

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…


joelahilliard
PROOP

3 months ago

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?


joelahilliard
PROOP

3 months ago

yes


joelahilliard
PROOP

3 months ago

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.


joelahilliard
PROOP

3 months ago

They are in the same region. I have tried several different approaches but cannot seem to solve this.


joelahilliard
PROOP

3 months ago

I am using a connectio pool, I have separated my transaction into read and write commitments… idk what else


hi hello


Project ID?


joelahilliard
PROOP

3 months ago

7285e955-ea9a-40ea-987f-ddb649ead44b


joelahilliard
PROOP

3 months ago

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…


going to make sure it's not a host


joelahilliard
PROOP

3 months ago

Thank you.


zero-xb
PRO

3 months ago

Yeah I'm having issues with DB connecting


zero-xb
PRO

3 months ago

Causing intermittent issues with services.


3 months ago

Are you part of 0xJah team? (considering your username) if not, can you open your own help thread?


zero-xb
PRO

3 months ago

No separate. I'll create my own thread.


Okay, should be okay now @0xJah


I don't think it was load but we've been playing whack a mole on some fraudsters


joelahilliard
PROOP

3 months ago

10-4. For my sanity, was it my code?


joelahilliard
PROOP

3 months ago

Let me rephrase: was it solely due to my bad code or something else?


joelahilliard
PROOP

3 months ago

sadly, i dont think this fixed it @angelo


might take a bit to run a full investigation then


do you have traces with some latency times you can send over?


joelahilliard
PROOP

3 months ago

@angelo How can get you a trace? Is this on railway or a different method needed


Usually a log from mySQL stating how long the operation time took


joelahilliard
PROOP

3 months ago

ok one moment


joelahilliard
PROOP

3 months ago

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


joelahilliard
PROOP

3 months ago

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


joelahilliard
PROOP

3 months ago

didnt fix it but changing the 'sync_binlog' to 0 worked


Loading...