cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Monitoring long running queries
Date Tue, 13 Sep 2016 19:18:08 GMT
Hah, I didn't even know we had this feature. And it is used in that same 'logSelectCount' method
that I mentioned :)

It should actually get invoked for all types of queries: SelectQuery, SQLTemplate, ProcedureQuery
and all their 4.0 fluent wrappers.

Andrus

> On Sep 13, 2016, at 3:08 PM, John Huss <johnthuss@gmail.com> wrote:
> 
> Sorry, you're right. I posted the wrong property.  It should be this one
> 
> Constants.QUERY_EXECUTION_TIME_LOGGING_THRESHOLD_PROPERTY
> 
> 
> 
> On Tue, Sep 13, 2016 at 1:47 PM Andrus Adamchik <andrus@objectstyle.org>
> wrote:
> 
>> JDBC_MAX_QUEUE_WAIT_TIME is the max time to wait for connections from
>> connection pool, so it wouldn't cancel long-running queries or anything.
>> 
>> From Hugi's description, all the EOF feature does is conditionally output
>> some logs on slower queries. While I'd handle that in a UNIX way by
>> attaching some external watch script to the logs, there's certainly a
>> Cayenne way for dealing with this too by binding a custom JdbcEventLogger
>> in DI (decorate JdbcEventLogger or subclass CommonsJdbcEventLogger) and
>> implementing alert logic in overridden 'logSelectCount' method that takes
>> query time as a parameter.
>> 
>> (On a side note, I am looking to having a JMX or metrics framework
>> integration in Cayenne to be able to gather statistics via in a centralized
>> place and let user code to consume it in any way they want).
>> 
>> Andrus
>> 
>> 
>> 
>> 
>>> On Sep 9, 2016, at 10:06 AM, John Huss <johnthuss@gmail.com> wrote:
>>> 
>>> You can set the property in the module when creating your ServerRuntime:
>>> 
>>> new Module() {
>>> 
>>> @Override
>>> 
>>> public void configure(Binder binder) {
>>> 
>>> MapBuilder<Object> props = binder.bindMap(Constants.PROPERTIES_MAP);
>>> 
>>> props.put(Constants.JDBC_MAX_QUEUE_WAIT_TIME, 8000); // 8 seconds
>>> 
>>> }
>>> 
>>> }
>>> 
>>> This only will report AFTER the query finishes, so it not really valuable
>>> if your query is really hung for a very long time.  But for general
>>> slowness it works.
>>> 
>>> 
>>> 
>>> On Fri, Sep 9, 2016 at 8:42 AM Hugi Thordarson <hugi@karlmenn.is> wrote:
>>> 
>>>> Hi all,
>>>> in EOF we could make the application log a warning if a DB query was
>>>> taking more than a specified amount of time to complete.
>>>> 
>>>> Is there any location where I could plug into Cayenne to do something
>>>> similar? We’re deploying a reporting system for a large-ish database
>> and I
>>>> know some queries might be problematic—so I’d like to watch out for
>> this as
>>>> we deploy.
>>>> 
>>>> Cheers,
>>>> - hugi
>>>> 
>>>> // Hugi Thordarson
>>>> // http://www.loftfar.is/
>>>> // s. 895-6688
>>>> 
>>>> 
>>>> 
>>>> 
>> 
>> 


Mime
View raw message