On Tuesday, August 21, 2018 at 8:06:40 PM UTC-7, Stephen Weil wrote:
>
> Background: we have an application running with Sequel 4.42.1 on JRuby 
> 9.1.13.0 connecting to a 3-node MariaDB cluster. We have some queries where 
> Sequel is logging times ~ (1.5s), but when we are checking DB those queries 
> are all executing much faster (~.3s). We've checked packet transfers 
> between application and DB, and those times are also fast. For one of the 
> queries taking 1.5s, we can see the request/response between application 
> and DB at around .3s. I'm trying to understand this discrepancy, so I was 
> looking for some clarification around exactly what is included in the log 
> time. Does it include time to acquire a connection from connection pool or 
> validate that connection (using the connection_validator extension)? Does 
> it include any other processing time (mapping DB response to Ruby objects, 
> etc)? 
>
> Thanks for any insight or help anyone has to offer
>

In general it is the time taken by the query execution method of the 
connection object. In the jdbc adapter, this is the time taken for 
Statement/PreparedStatement execute, executeQuery, and executeUpdate, .  
That could be substantially different than the database query time if the 
JDBC driver is doing significant internal processing or there is 
significant network latency.  It does not include time to acquire a 
connection or validate the connection, though queries issued when setting 
up a new connection or validating a connection should be logged separately 
with their own execution times.  It does not generally include mapping the 
database response to ruby objects, though theoretically an adapter could do 
that (the jdbc adapter doesn't).

In the version of Sequel you are using, it could also be caused by time 
changes on the application server.  That issue has been fixed in a recent 
Sequel version.  I don't think that is your problem, as based on your 
description the problem appears to happen every time, not just occasionally.

If you would like details on what is being timed, grep the jdbc adapter for 
log_connection_yield, since the time taken by the block passed to that 
method is what is logged.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to