You can’t really usefully duplicate the open connection fd this way — if
you think about it, when you duplicate a network fd, the new fd has the
same endpoints (srcip:srcport dstip:dstport) as the original, meaning there
would be no way for the local system to know which of your multiple
processes a response is destined for. There’s still only one TCP stream, no
matter how many pointers you have to it.

If you’re just going to fork a new process, hit memcache once, and then
exit, you really don’t have any options besides “don’t use persistent
connections and open a new connection with each process”. If performance is
*super* critical (…which it’s not, if you’re forking a new process per
request), you could do memcache over UDP, but you probably don’t need/want
to do that.

-j

On Mon, Jul 25, 2016 at 3:17 AM, <joun...@gmail.com> wrote:

>
> A traditional web-server application forks a new process for every request
> with 'fork' (man -s2 fork). Question how to use memcached_pool with
> processes.
>
> With processes, the memory is isolated between the processes. After fork,
> the whole memcached_pool is doubled to a new process. Freeing the memory
> after the request is served and the child process is closing, causes an
> instability (was it an illegal close or a segfault). In addition, copying
> the pool to each client does not seem to be reasonable.
>
> The solution in use now is to use 'memcached' instead of
> 'memcached_pool_pop' to get a new connection (allways to the next client
> process). It is recommended in the ~/doc/protocol.txt that the memcached is
> used with multiple open connections and not to open a new connection every
> time.
>
> What is the best practise with 'fork'?
>
> How can I make my server application faster? Is it possible to use
> 'memcached_pool'? Is it somehow possible to just 'dup' the memcached socket
> connection somehow or is dupping the socket connections this way possible
> at all?
>
> With best regards,
>
> Jouni
>
>
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "memcached" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to memcached+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to