Tags: quantcast/g2
Tags
Fix send/receive synchronization race condition (#12) * Fix send/receive synchronization race condition * restore cleanup and submitJob name * Rename submitJob * Add locking of job submission to single-thread it * Add some logging * Fix premature dequeuing issue * Remove extra logging * Remove submit locks * Remove drain debug logging * rename constants and change queue size to 8
client: major overhaul of buffer management This still maintains a double-copy which is less than ideal, but is significantly faster as a result because the target region which holds the `data` parameter to the response is now dynamically allocated so as to avoid unnecessary copies and dynamic/exponential allocation. Further cleaned-up the parsing of the response and removed the `decodeResponse` function which had lots of funky logic around wierd buffer management. Abstracted the reconnect behavior out into a separate method so it can be reused whether the header or buffer are being read.
client: gearman client now faster and better Eliminated the strange usage of in favor of using channels. Removed the redundant `processLoop` goroutine, the `readLoop` now inlines the processing (it was serial anyway!). Switched to the use of threadsafe memory object pools for request and response objects, and now allows pipelining if multiple goroutines are making requests at once. Removed a lot of redundancy in the code, and eliminated the use of the strange `responseHandlerMap` in favor of a concurrent map for holding callbacks on a per-handler basis. Refactored the `request` type such that it now uses a builder pattern, and now itself keeps a small byte buffer for each request which is reused when parameters are attached to requests. Streamlined the formatting of outbound messages such that they are encoded as they are written to the output buffer, to reduce the number of copies involved in most operations. Eliminated the strange blind-read loop which pretended it had no idea how large of a buffer it would need to allocate to read a response, and now allocates a buffer for each payload, the size of the payload as specified by the server, respectively.
client: gearman client now faster and better Eliminated the strange usage of in favor of using channels. Removed the redundant `processLoop` goroutine, the `readLoop` now inlines the processing (it was serial anyway!). Switched to the use of threadsafe memory object pools for request and response objects, and now allows pipelining if multiple goroutines are making requests at once. Removed a lot of redundancy in the code, and eliminated the use of the strange `responseHandlerMap` in favor of a concurrent map for holding callbacks on a per-handler basis. Refactored the `request` type such that it now uses a builder pattern, and now itself keeps a small byte buffer for each request which is reused when parameters are attached to requests. Streamlined the formatting of outbound messages such that they are encoded as they are written to the output buffer, to reduce the number of copies involved in most operations. Eliminated the strange blind-read loop which pretended it had no idea how large of a buffer it would need to allocate to read a response, and now allocates a buffer for each payload, the size of the payload as specified by the server, respectively.
PreviousNext