So, after investigation, I think we can proceed with proper parallelised RPCs in Haskell, curl-based.
There are still downsides, but this should allow all things to proceed along. The proposed fix is as follows. First, implement (in Ganeti) a low-level FFI interface to the libcurl multi interface (http://curl.haxx.se/libcurl/c/libcurl-multi.html), using both libcurl (C) and bits of the Network.Curl (Haskell) library. This implementation will still be restricted to single-threaded programs (SSL issues), but they will allow a binary to run parallelised HTTP connections. Also, the implementation will not contain full shutdown/cleanup, as it is designed only for short-lived binaries. Second, reuse the fork model proposed last year, but with a twist: - confd forks one process for a query (only one, not N) - it provides this program (from before fork) with the target node lists, parameters, etc. - forked child does the query and writes all responses to temporary files; two files per node: one file with output or error message, and one file with exit code (alternatively, a single file with all result codes) - exit status from child is overall result; individual results come as the above - once the child program finishes, confd processes the results and completes the query This allows to workaround memory leaks in the Curl library, respond to multiple queries in parallel while working around SSL issues in Curl, and reduce resource usage by only forking one child. The only downside to this approach that I know of right now is in the proposed implementation of the 'multi' interface will be polling. Basically there's no easy way to use 'select' in Haskell, and we have few options: - write FFI code to have select/FD_ZERO exposed somehow - write C code that does that and expose it via FFI - use http://hackage.haskell.org/package/select, but that is not packaged and its definitions might conflict with the curl FFI - use polling I would start with polling, and then look at FFI for select, if possible. Comments? (Beside that FFI is pretty cool once you start using it!) thanks, iustin
