summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_router.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-12-28HTTP keep-alive connections support.Igor Sysoev1-640/+120
2017-12-28Changed nxt_mp_retain() and nxt_mp_release() interfaces.Igor Sysoev1-4/+13
2017-12-27Implementing worker stop after limits.requests.Max Romanov1-4/+13
2017-12-27Rescheduling of pending request after configured timeout.Max Romanov1-83/+214
New optional configuration parameter introduced: limits.reschedule_timeout. Default value 1 second. In the case when request is written to the port socket 'in advance', it is called 'pending'. On every completed request, the head of pending request is checked against reschedule timeout. If this request waiting for execution longer than timeout, it is cancelled, new port selected for this request.
2017-12-27Fixing code style.Max Romanov1-16/+16
2017-12-27Fixing application timeout.Max Romanov1-89/+318
Application timeout limits maximum time of worker response in processing particular request. Not including the time required to start worker, time in request queue etc.
2017-12-27Changing worker selection precedence.Max Romanov1-22/+47
This patch increase precedence of non-started worker over busy worker. 1. idle worker; 2. start new worker; 3. busy worker, but can accept request in advance;
2017-12-27Implementing the ability to cancel request before worker starts processing it.Max Romanov1-131/+103
2017-12-25HTTP parser: reworked header fields handling.Valentin Bartenev1-8/+8
2017-12-25Restoring apps in case of reconfiguration error.Max Romanov1-0/+3
2017-11-27A number of engine connections is decreased on connection close.Igor Sysoev1-1/+1
2017-10-19Keep application worker until response for all requests received.Max Romanov1-1/+4
2017-10-19Fixed the bug introduced in the previous changeset.Igor Sysoev1-4/+9
2017-10-18Router: fixed segfault after configuration change.Igor Sysoev1-177/+241
2017-10-17Storing memory cache slot hint inside nxt_sockaddr_t.Igor Sysoev1-3/+5
2017-10-10Optimized application type handling.Valentin Bartenev1-17/+2
2017-10-04Port message fragmentation supported.Max Romanov1-15/+9
- Each sendmsg() transmits no more than port->max_size payload data. - Longer buffers are fragmented and send using multiple sendmsg() calls. - On receive side, buffers are connected in chain. - Number of handler calls is the same as number of nxt_port_socket_write() calls. - nxt_buf_make_plain() function introduced to make single plain buffer from the chain.
2017-10-04Optimized request<->app link allocation.Max Romanov1-36/+59
Only purpose of request<->app link instance is to be enqueued in application requests queue. It is possible to avoid request<->app link allocation from memory pool in case when spare application port is available. Instance from local stack can be used to prepare and send message to application.
2017-10-04Using port 'post' facility to proxy remove pid message to workers.Max Romanov1-83/+21
Remove pid proxying to worker engines implementation was originally overcomplicated. Memory pool and 2 engine posts (there and back again) are optimized out and replaced with band new nxt_port_post() call.
2017-10-04Using request mem pool for req<->app link.Max Romanov1-2/+19
Request <-> application link structure (nxt_req_app_link_t) used to register the request in application request queue (nxt_app_t.requests) and generate application-specific port message. Now it is allocated from request pool. This pool created for request parsing and used to allocate and store information specific to this request.
2017-10-04Fixed error generation during request processing.Max Romanov1-40/+94
Request can be processed in thread different from the thread where the connection originally handled. Because of possible racing conditions, using original connection structures is unsafe. To solve this, error condition is registered in 'ra' (request <-> application link) and traversed back to original connection thread where the error message can be generated and send back to client.
2017-10-04Introducing use counters for port and app. Thread safe port write.Max Romanov1-330/+432
Use counter helps to simplify logic around port and application free. Port 'post' function introduced to simplify post execution of particular function to original port engine's thread. Write message queue is protected by mutex which makes port write operation thread safe.
2017-10-04Using engine memiory pool for port write allocations.Max Romanov1-7/+1
To allow use port from different threads, the first step is to avoid using port's memory pool for temporary allocations required to send data through the port. Including but not limited by: - buffers for data; - send message structures; - new mmap fd notifications; It is still safe to use port memory pool for incoming buffers allocations because recieve operation bound to single thread.
2017-10-04Fixing memory leak when handling remove pid message.Max Romanov1-0/+2
Worker threads ports need to receive 'remove pid' message to properly handle application process exit case and finish requests processed by particular application worker. Main process send 'remove pid' notification to service thread port only and this message must be 'proxied' to other running engines. Separate memory pool created for this message. For each engine structure required to post message to engine allocate from the pool using 'retain' allocation method. After successfull post structure will be freed using 'release' method. To completely destroy poll one more 'release' should be called to release initial reference count. I'm afraid this should be simplified using good old malloc() and free() calls.
2017-09-27Event engine memory cache for nxt_sockaddr_t.Igor Sysoev1-3/+10
Introducing event engine memory cache and using the cache for nxt_sockaddr_t structures.
2017-09-22Removed fibers from compilation.Valentin Bartenev1-0/+2
It's not used anyway, but breaks building with musl. This closes issue #5 on GitHub.
2017-09-15Introducing named port message handlers to avoid misprints.Max Romanov1-16/+4
2017-09-15Fixing memory leak of request parse context.Max Romanov1-10/+11
2017-09-15Introducing application timeout.Max Romanov1-76/+334
2017-09-15Fixed port handlers arrays.Valentin Bartenev1-0/+3
2017-09-15Router: more logical code order change.Igor Sysoev1-2/+2
Updating the router engines list before posting jobs to worker thread engines is more logical because worker threads may exit after the posting. However, the previous code was safe because an engine is freed by the router main thread after worker its thread has exited.
2017-09-14Router: fixed segmentation fault.Igor Sysoev1-10/+32
The router process exited abnormally on reconfiguration if number of worker threads had been decreased on the previous reconfiguration. Besides the list of router engines should be updated only after a new configuration joints have been prepared for all engines.
2017-09-14Router: worker threads should quit only if the main thread hasIgor Sysoev1-1/+54
requested this.
2017-09-14Fixed textual socket name lengths and Unix domain sockaddr length.Igor Sysoev1-2/+2
2017-09-07Moving body data before headers for PHP POST.Max Romanov1-5/+20
PHP SAPI tries to read body for POST request before registering header-specific variables. For other methods, read_post_body() called by SAPI after variables registration. This closes #10 issue on GitHub.
2017-09-06Style fixes.Igor Sysoev1-17/+31
2017-09-05Fixing request id logging.Max Romanov1-1/+1
2017-09-05Fixing racing condition on app port release/request.Max Romanov1-1/+21
Application free ports is a queue (double linked list) protected with mutex. After successfull request parsing, each router thread (1) tries to get port from this list. If this list is empty, (2) start worker request posted to main router thread. Another thread may release port between (1) and (2). This fix adds an attempt to get port from free ports list at the beginning of start worker action in main thread.
2017-09-05Double connection close attempt fix.Max Romanov1-2/+11
2017-09-01Added SERVER_ADDR parameter for Python and PHP modules.Igor Sysoev1-0/+7
2017-08-31Multiplexing different requests in single app port.Max Romanov1-0/+5
2017-08-31Default value 1 for number of workers.Max Romanov1-0/+2
2017-08-30Send remote address to go application.Max Romanov1-0/+1
2017-08-29Fixed debug message broken in e8da77a2c293.Max Romanov1-4/+3
2017-08-29The master process has been renamed to the main process.Igor Sysoev1-13/+13
2017-08-26Introduced nxt_socket_defer_accept().Igor Sysoev1-6/+1
2017-08-17The new module configuration interface.Igor Sysoev1-6/+271
Configuration and building example: ./configure ./configure python ./configure php ./configure go make all or ./configure make nginext ./configure python make python ./configure php make php ./configure go make go Modules configuration options and building examples: ./configure python --module=python2 --config=python2.7-config make python2 ./configure php --module=php7 --config=php7.0-config --lib-path=/usr/local/php7.0 make php7 ./configure go --go=go1.6 --go-path=${HOME}/go1.6 make go1.6
2017-08-16Object mapping interface extended with more string types.Valentin Bartenev1-6/+6
2017-08-11Controller: more HTTP headers and detailed JSON parsing errors.Valentin Bartenev1-1/+1
2017-08-11Request body read state implemented.Max Romanov1-51/+191
With specific timeout and buffer size settings.