this module will block nginx main cycle(block other requests) #50
Open
Description
hi,
ngx module code ::
/* Fetch the chunk from mongo */
do {
e = FALSE;
cursors[i] = gridfile_get_chunks(&gfile, i, 1);
if (!(cursors[i] && mongo_cursor_next(cursors[i]) == MONGO_OK)) {
e = TRUE; ecounter++;
if (ecounter > MONGO_MAX_RETRIES_PER_REQUEST
|| ngx_http_mongo_reconnect(request->connection->log, mongo_conn) == NGX_ERROR
|| ngx_http_mongo_reauth(request->connection->log, mongo_conn) == NGX_ERROR) {
ngx_log_error(NGX_LOG_ERR, request->connection->log, 0,
"Mongo connection dropped, could not reconnect");
if(&mongo_conn->conn.connected) { mongo_disconnect(&mongo_conn->conn); }
gridfile_destroy(&gfile);
gridfs_destroy(&gfs);
return NGX_HTTP_SERVICE_UNAVAILABLE;
}
}
} while (e);
this will call mongo_cursor_get_more
::
static int mongo_cursor_get_more( mongo_cursor *cursor ) {
int res;
...
mm = mongo_message_create( 16 /*header*/
+4 /*ZERO*/
+sl
+4 /*numToReturn*/
+8 /*cursorID*/
, 0, 0, MONGO_OP_GET_MORE );
res = mongo_message_send( cursor->conn, mm );
res = mongo_read_response( cursor->conn, &( cursor->reply ) );
}
static int mongo_read_response( mongo *conn, mongo_reply **reply ) {
mongo_env_read_socket( conn, &head, sizeof( head ) );
//which will do a blocking read.
...
}
the blocking read will block nginx worker, other request will be blocked.
have you make any benchmark on this module?
Metadata
Assignees
Labels
No labels