Oracle ORDS takes 2 secs (slow) to respond to simplest query

Viewed 1388

Firefox and Chrome report ~2000ms response time (localhost) to my REST API. The database executes the query in under 1ms. A static JSON file with the same content is served in 4ms.

Where is all the time going? Is ORDS.war consuming it, is it database connection time, is Tomcat using it or something else? How do I find the root cause?

Update: Win10. Stopped Apache service and tried running catalina.bat from command line and response time drops to ~30ms. Killed it and tried running as a service again - response time consistently ~170ms.

I have an ORDS 3.0.11.180.12.34 service running on Tomcat 8.5.16 (jre1.8.0_144 x64) running this query:

SELECT 1 FROM dual

as below

DECLARE
l_handler_id        ords_metadata.ords_handlers.id%TYPE := NULL;
l_param_id          ords_metadata.ords_parameters.id%TYPE := NULL;

l_module_name       ords_metadata.ords_modules.name%type := 'rest';
l_pattern           ords_metadata.ords_templates.uri_template%type := 'select_1_from_dual';
l_method            ords_metadata.ords_handlers.method%type := 'GET';

BEGIN

ords.define_template (
    p_module_name => l_module_name,
    p_etag_type   => 'QUERY',
    p_etag_query  => q'~SELECT dbms_random.value(0,1) FROM dual~',
    p_pattern     => l_pattern
);

ords.define_handler (
    p_module_name => l_module_name,
    p_pattern     => l_pattern,
    p_method      => l_method,
    p_source_type => ords.source_type_collection_item,
    p_source      => 'SELECT 1 FROM dual'
);

COMMIT;
END;
/
0 Answers
Related