node.js - Why datastax/nodejs-driver is slow? -
it takes 20 seconds response simple select query using nodejs driver. cqlsh takes less 1 second.
enabled logging on connection , shows lot of connection events below
select * developer username=? 2015-06-13t05:48:39.635z log event: info -- "controlconnection" 2015-06-13t05:48:39.635z log event: info -- "controlconnection" 2015-06-13t05:48:39.637z log event: info -- "connection" 2015-06-13t05:48:44.641z log event: warning -- "connection" 2015-06-13t05:48:44.641z log event: info -- "connection" 2015-06-13t05:48:49.646z log event: warning -- "connection" 2015-06-13t05:48:49.647z log event: info -- "connection" 2015-06-13t05:48:49.647z log event: verbose -- "connection" 2015-06-13t05:48:49.648z log event: verbose -- "connection" 2015-06-13t05:48:49.648z log event: verbose -- "connection" 2015-06-13t05:48:49.651z log event: verbose -- "connection" 2015-06-13t05:48:49.651z log event: info -- "connection" 2015-06-13t05:48:49.652z log event: verbose -- "connection" 2015-06-13t05:48:49.652z log event: verbose -- "connection" 2015-06-13t05:48:49.652z log event: verbose -- "connection" 2015-06-13t05:48:49.653z log event: verbose -- "connection" 2015-06-13t05:48:49.654z log event: verbose -- "connection" 2015-06-13t05:48:49.654z log event: verbose -- "connection" 2015-06-13t05:48:49.654z log event: info -- "controlconnection" 2015-06-13t05:48:49.654z log event: info -- "controlconnection" 2015-06-13t05:48:49.654z log event: verbose -- "connection" 2015-06-13t05:48:49.655z log event: verbose -- "connection" 2015-06-13t05:48:49.662z log event: verbose -- "connection" 2015-06-13t05:48:49.662z log event: info -- "controlconnection" 2015-06-13t05:48:49.662z log event: verbose -- "connection" 2015-06-13t05:48:49.663z log event: verbose -- "connection" 2015-06-13t05:48:49.663z log event: verbose -- "connection" 2015-06-13t05:48:49.684z log event: verbose -- "connection" 2015-06-13t05:48:49.684z log event: info -- "controlconnection" 2015-06-13t05:48:49.684z log event: info -- "controlconnection" 2015-06-13t05:48:49.684z log event: verbose -- "connection" 2015-06-13t05:48:49.684z log event: verbose -- "connection" 2015-06-13t05:48:49.684z log event: verbose -- "connection" 2015-06-13t05:48:49.690z log event: verbose -- "connection" 2015-06-13t05:48:49.718z log event: verbose -- "connection" 2015-06-13t05:48:49.718z log event: verbose -- "connection" 2015-06-13t05:48:49.719z log event: verbose -- "connection" 2015-06-13t05:48:49.725z log event: verbose -- "connection" 2015-06-13t05:48:49.725z log event: info -- "controlconnection" 2015-06-13t05:48:49.725z log event: verbose -- "connection" 2015-06-13t05:48:49.726z log event: verbose -- "connection" 2015-06-13t05:48:49.726z log event: verbose -- "connection" 2015-06-13t05:48:49.726z log event: verbose -- "connection" 2015-06-13t05:48:49.727z log event: verbose -- "connection" 2015-06-13t05:48:49.727z log event: info -- "connection" 2015-06-13t05:48:54.728z log event: warning -- "connection" 2015-06-13t05:48:54.729z log event: info -- "connection" 2015-06-13t05:48:59.734z log event: warning -- "connection" 2015-06-13t05:48:59.735z log event: verbose -- "connection" 2015-06-13t05:48:59.735z log event: verbose -- "connection" 2015-06-13t05:49:00.160z log event: verbose -- "connection" result 1
any idea why happens?
the node.js driver features node auto discovery. indicates driver become aware of other nodes participating in cluster though single contact point supplied.
looking @ log message in original post see warning messages labeled connection
. while don't have full log messages here, guess attempted try 2 unavailable nodes before moving on third node accessible. looking @ source code of driver in connection.js
see warning emitted when there error connecting.
furthermore in client-options.js
see there timeout on connections of 5 seconds. matches timing between log messages in output.
if driver attempting connect each node failing, waiting timeouts account ~20 second query time. make sure nodes individually accessible , see performance increase.
Comments
Post a Comment