Re: Apache + mod_php performance

Liste des GroupesRevenir à co vms 
Sujet : Re: Apache + mod_php performance
De : cross (at) *nospam* spitfire.i.gajendra.net (Dan Cross)
Groupes : comp.os.vms
Date : 02. Oct 2024, 20:38:26
Autres entêtes
Organisation : PANIX Public Access Internet and UNIX, NYC
Message-ID : <vdk7fi$jdm$1@reader1.panix.com>
References : 1 2 3 4
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <vdd2mr$1tq3s$4@dont-email.me>,
Arne Vajhøj  <arne@vajhoej.dk> wrote:
On 9/29/2024 10:03 PM, Lawrence D'Oliveiro wrote:
On Sun, 29 Sep 2024 21:58:45 -0400, Arne Vajhøj wrote:
 
On 9/29/2024 9:46 PM, Lawrence D'Oliveiro wrote:
>
On Sun, 29 Sep 2024 21:42:48 -0400, Arne Vajhøj wrote:
>
On 9/29/2024 9:21 PM, Lawrence D'Oliveiro wrote:
>
Then it asks another process for a copy of that socket descriptor.
Perhaps there is one overall connection-management process that
accepts all new connections; if not, another worker that has that
socket can pass it along.
>
It should not be a problem of copying a socket descriptor from one
process to another process - I believe it is just an int.
>
But will it work in the other process????
>
That’s not how you do it. You pass it with the SCM_RIGHTS
ancillary-data option in Unix-family sockets
<https://manpages.debian.org/7/unix.7.en.html>.
>
Worker A has a AF_INET socket to client so what AF_UNIX socket does it
pass to worker B?
 
You can pass any FD (AF_INET socket, file, pipe, even another AF_UNIX
socket) over an AF_UNIX socket.
>
Ah. Interesting. Very interesting.

Access rights passing over Unix domain sockets was introduced in
4.2BSD, in 1983: more than 40 years ago.  The basic mechanism
was updated in 4.4BSD, in 1994: 30 years ago.  Here's a working
example:

// Passing access rights between processes over Unix domain
// sockets.
//
// Dan Cross <cross@gajendra.net>

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>

#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

// Sends a file descripter, `fd`, over a Unix domain socket `sd`
// via the 4.4BSD access rights passing mechanism.
//
// Returns 1 on success, -1 on failure.
int
sendfd(int sd, int fd)
{
struct msghdr mh;
struct iovec iv;
struct cmsghdr *ptr;
size_t len;
int ret;
char dummy;

// Construct the control message header.  Note this is
// malloc'ed to ensure proper alignment.
len = CMSG_SPACE(sizeof(int));
ptr = malloc(len);
if (ptr == NULL)
return -1;
memset(ptr, 0, len);
ptr->cmsg_len = len;
ptr->cmsg_level = SOL_SOCKET;
ptr->cmsg_type  = SCM_RIGHTS;
memcpy(CMSG_DATA(ptr), &fd, sizeof(int));

// We send a single byte of dummy data in case the
// implementation does not pass control data with an
// otherwise empty data transfer.
dummy = 0;
memset(&iv, 0, sizeof(iv));
iv.iov_base = &dummy;
iv.iov_len  = 1;

// Construct the message header.  Points to the dummy
// data and the control message header.
memset(&mh, 0, sizeof(mh));
mh.msg_name = NULL;
mh.msg_namelen = 0;
mh.msg_iov = &iv;
mh.msg_iovlen = 1;
mh.msg_control = (caddr_t)ptr;
mh.msg_controllen = len;
mh.msg_flags = 0;

// Loop in case there's no room in the kernel buffer
// to send.  Cf.Stevens et al.
do {
ret = sendmsg(sd, &mh, 0);
} while (ret == 0);
free(ptr);

return ret;
}

// Receives a file descriptor over the Unix domain socket `sd`
// and store it into `*fdp` on success.
//
// Returns 1 on success, 0 on EOF, -1 on error.
int
recv_fd(int sd, int *fdp)
{
struct msghdr mh;
struct iovec iv;
struct cmsghdr *ptr;
size_t len;
int ret;
char dummy;

if (fdp == NULL)
return -1;

// Allocate space for the control structure.
len = CMSG_SPACE(sizeof(int));
ptr = malloc(len);
if (ptr == NULL)
return -1;

// Fill in an iovec to receive one byte of dummy data.
// Required on some systems that do not pass control
// messages on empty data transfers.
memset(&iv, 0, sizeof(iv));
iv.iov_base = &dummy;
iv.iov_len  = 1;

// Fill in the msghdr structure.  `recvmsg(2)` will
// update it.
memset(&mh, 0, sizeof(mh));
mh.msg_name = NULL;
mh.msg_namelen = 0;
mh.msg_iov = &iv;
mh.msg_iovlen = 1;
mh.msg_control = ptr;
mh.msg_controllen = len;
mh.msg_flags = 0;

ret = recvmsg(sd, &mh, 0);
if (ret <= 0) {
free(ptr);
return ret;
}
if (mh.msg_flags != 0) {
free(ptr);
return -1;
}
memcpy(fdp, CMSG_DATA(ptr), sizeof(int));
free(ptr);

return 1;
}

But I am pretty sure that it will not work on VMS.

There's some chatter that suggests Unix domain sockets were
added in OpenVMS 8.4, in 2010: 14 years ago:
https://de.openvms.org/TUD2011/Unix_Portability_Updates_and_Open_Source.pdf

I haven't checked myself; even if the basic Unix domain sockets
mechanism was added for IPC, it's not clear if the access rights
transfer functionality was also implemented.

- Dan C.


Date Sujet#  Auteur
24 Sep 24 * Apache + mod_php performance274Arne Vajhøj
24 Sep 24 +* Re: Apache + mod_php performance267Dan Cross
25 Sep 24 i`* Re: Apache + mod_php performance266Arne Vajhøj
25 Sep 24 i `* Re: Apache + mod_php performance265Dan Cross
25 Sep 24 i  `* Re: Apache + mod_php performance264Arne Vajhøj
25 Sep 24 i   +* Re: Apache + mod_php performance262Dan Cross
25 Sep 24 i   i`* Re: Apache + mod_php performance261Arne Vajhøj
25 Sep 24 i   i +* Re: Apache + mod_php performance12Arne Vajhøj
25 Sep 24 i   i i+- Re: Apache + mod_php performance1Lawrence D'Oliveiro
25 Sep 24 i   i i+* Re: Apache + mod_php performance3Lawrence D'Oliveiro
26 Sep 24 i   i ii`* Re: Apache + mod_php performance2Arne Vajhøj
26 Sep 24 i   i ii `- Re: Apache + mod_php performance1Lawrence D'Oliveiro
26 Sep 24 i   i i`* Re: Apache + mod_php performance7Craig A. Berry
26 Sep 24 i   i i +- Re: Apache + mod_php performance1Arne Vajhøj
26 Sep 24 i   i i `* Re: Apache + mod_php performance5Lawrence D'Oliveiro
27 Sep 24 i   i i  `* Re: Apache + mod_php performance4Arne Vajhøj
27 Sep 24 i   i i   `* Re: Apache + mod_php performance3Lawrence D'Oliveiro
27 Sep 24 i   i i    `* Re: Apache + mod_php performance2Craig A. Berry
27 Sep 24 i   i i     `- Re: Apache + mod_php performance1Lawrence D'Oliveiro
25 Sep 24 i   i +- Re: Apache + mod_php performance1Arne Vajhøj
26 Sep 24 i   i +* Re: Apache + mod_php performance21Arne Vajhøj
26 Sep 24 i   i i+* Re: Apache + mod_php performance3Lawrence D'Oliveiro
26 Sep 24 i   i ii`* Re: Apache + mod_php performance2Arne Vajhøj
26 Sep 24 i   i ii `- Re: Apache + mod_php performance1Lawrence D'Oliveiro
26 Sep 24 i   i i`* Re: Apache + mod_php performance17Craig A. Berry
26 Sep 24 i   i i `* Re: Apache + mod_php performance16Craig A. Berry
26 Sep 24 i   i i  +* Re: Apache + mod_php performance2Chris Townley
26 Sep 24 i   i i  i`- Re: Apache + mod_php performance1Arne Vajhøj
27 Sep 24 i   i i  `* Re: Apache + mod_php performance13Arne Vajhøj
27 Sep 24 i   i i   `* Re: Apache + mod_php performance12Lawrence D'Oliveiro
27 Sep 24 i   i i    `* Re: Apache + mod_php performance11Arne Vajhøj
27 Sep 24 i   i i     +* Re: Apache + mod_php performance3Lawrence D'Oliveiro
27 Sep 24 i   i i     i`* Re: Apache + mod_php performance2Arne Vajhøj
28 Sep 24 i   i i     i `- Re: Apache + mod_php performance1Lawrence D'Oliveiro
27 Sep 24 i   i i     +* Re: Apache + mod_php performance2Simon Clubley
27 Sep 24 i   i i     i`- Re: Apache + mod_php performance1Arne Vajhøj
27 Sep 24 i   i i     `* Re: Apache + mod_php performance5Craig A. Berry
27 Sep 24 i   i i      `* Re: Apache + mod_php performance4Arne Vajhøj
27 Sep 24 i   i i       `* Re: Apache + mod_php performance3Dan Cross
27 Sep 24 i   i i        `* Re: Apache + mod_php performance2Arne Vajhøj
27 Sep 24 i   i i         `- Re: Apache + mod_php performance1Dan Cross
26 Sep 24 i   i +* Re: Apache + mod_php performance38Dan Cross
27 Sep 24 i   i i`* Re: Apache + mod_php performance37Arne Vajhøj
27 Sep 24 i   i i +* Re: Apache + mod_php performance2Chris Townley
27 Sep 24 i   i i i`- Re: Apache + mod_php performance1Arne Vajhøj
27 Sep 24 i   i i +* Re: Apache + mod_php performance9Dan Cross
27 Sep 24 i   i i i`* Re: Apache + mod_php performance8Arne Vajhøj
27 Sep 24 i   i i i `* Re: Apache + mod_php performance7Dan Cross
27 Sep 24 i   i i i  `* Re: Apache + mod_php performance6Arne Vajhøj
27 Sep 24 i   i i i   `* Re: Apache + mod_php performance5Dan Cross
27 Sep 24 i   i i i    `* Re: Apache + mod_php performance4Arne Vajhøj
27 Sep 24 i   i i i     `* Re: Apache + mod_php performance3Dan Cross
27 Sep 24 i   i i i      `* Re: Apache + mod_php performance2Arne Vajhøj
27 Sep 24 i   i i i       `- Re: Apache + mod_php performance1Dan Cross
28 Sep 24 i   i i `* Re: Apache + mod_php performance25Lawrence D'Oliveiro
28 Sep 24 i   i i  `* Re: Apache + mod_php performance24Arne Vajhøj
28 Sep 24 i   i i   `* Re: Apache + mod_php performance23Lawrence D'Oliveiro
28 Sep 24 i   i i    `* Re: Apache + mod_php performance22Arne Vajhøj
28 Sep 24 i   i i     +* Re: Apache + mod_php performance7Lawrence D'Oliveiro
28 Sep 24 i   i i     i`* Re: Apache + mod_php performance6Arne Vajhøj
28 Sep 24 i   i i     i `* Re: Apache + mod_php performance5Lawrence D'Oliveiro
28 Sep 24 i   i i     i  `* Re: Apache + mod_php performance4Arne Vajhøj
28 Sep 24 i   i i     i   `* Re: Apache + mod_php performance3Lawrence D'Oliveiro
28 Sep 24 i   i i     i    `* Re: Apache + mod_php performance2Arne Vajhøj
28 Sep 24 i   i i     i     `- Re: Apache + mod_php performance1Lawrence D'Oliveiro
28 Sep 24 i   i i     `* Re: Apache + mod_php performance14Arne Vajhøj
28 Sep 24 i   i i      `* Re: Apache + mod_php performance13Lawrence D'Oliveiro
28 Sep 24 i   i i       `* Re: Apache + mod_php performance12Arne Vajhøj
28 Sep 24 i   i i        +* Re: Apache + mod_php performance3Arne Vajhøj
28 Sep 24 i   i i        i`* Re: Apache + mod_php performance2Lawrence D'Oliveiro
28 Sep 24 i   i i        i `- Re: Apache + mod_php performance1Arne Vajhøj
28 Sep 24 i   i i        `* Re: Apache + mod_php performance8Lawrence D'Oliveiro
28 Sep 24 i   i i         `* Re: Apache + mod_php performance7Arne Vajhøj
28 Sep 24 i   i i          +- Re: Apache + mod_php performance1Chris Townley
28 Sep 24 i   i i          `* Re: Apache + mod_php performance5Lawrence D'Oliveiro
29 Sep 24 i   i i           +- Re: Apache + mod_php performance1Arne Vajhøj
29 Sep 24 i   i i           `* Re: Apache + mod_php performance3Craig A. Berry
29 Sep 24 i   i i            +- Re: Apache + mod_php performance1Arne Vajhøj
30 Sep 24 i   i i            `- Re: Apache + mod_php performance1Lawrence D'Oliveiro
28 Sep 24 i   i `* Re: Apache + mod_php performance188Arne Vajhøj
28 Sep 24 i   i  +* Re: Apache + mod_php performance56Dan Cross
28 Sep 24 i   i  i+* Re: Apache + mod_php performance51Arne Vajhøj
28 Sep 24 i   i  ii+- Re: Apache + mod_php performance1Lawrence D'Oliveiro
28 Sep 24 i   i  ii+* Re: Apache + mod_php performance48Dave Froble
1 Oct 24 i   i  iii`* Re: Apache + mod_php performance47Dan Cross
1 Oct 24 i   i  iii `* Re: Apache + mod_php performance46Arne Vajhøj
1 Oct 24 i   i  iii  +* Re: Apache + mod_php performance7Lawrence D'Oliveiro
2 Oct 24 i   i  iii  i`* Re: Apache + mod_php performance6Arne Vajhøj
2 Oct 24 i   i  iii  i `* Re: Apache + mod_php performance5Lawrence D'Oliveiro
3 Oct 24 i   i  iii  i  `* Re: Apache + mod_php performance4Arne Vajhøj
3 Oct 24 i   i  iii  i   `* Re: Apache + mod_php performance3Lawrence D'Oliveiro
3 Oct 24 i   i  iii  i    `* Re: Apache + mod_php performance2Arne Vajhøj
3 Oct 24 i   i  iii  i     `- Re: Apache + mod_php performance1Lawrence D'Oliveiro
2 Oct 24 i   i  iii  +* Re: Apache + mod_php performance5Dan Cross
2 Oct 24 i   i  iii  i`* Re: Apache + mod_php performance4Arne Vajhøj
2 Oct 24 i   i  iii  i `* Re: Apache + mod_php performance3Dan Cross
2 Oct 24 i   i  iii  i  `* Re: Apache + mod_php performance2Arne Vajhøj
2 Oct 24 i   i  iii  i   `- Re: Apache + mod_php performance1Dan Cross
2 Oct 24 i   i  iii  `* Re: Apache + mod_php performance33Dave Froble
2 Oct 24 i   i  iii   +* Re: Apache + mod_php performance31Arne Vajhøj
2 Oct 24 i   i  iii   i`* Re: Apache + mod_php performance30Dan Cross
2 Oct 24 i   i  iii   `- Re: Apache + mod_php performance1Dan Cross
30 Sep 24 i   i  ii`- Re: Apache + mod_php performance1Dan Cross
29 Sep 24 i   i  i`* Re: Apache + mod_php performance4Arne Vajhøj
28 Sep 24 i   i  `* Re: Apache + mod_php performance131Arne Vajhøj
27 Sep 24 i   `- Re: Apache + mod_php performance1Arne Vajhøj
24 Sep 24 +* Re: Apache + mod_php performance2Lawrence D'Oliveiro
25 Sep 24 +* Re: Apache + mod_php performance2Simon Clubley
2 Oct 24 `* Re: Apache + mod_php performance2Arne Vajhøj

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal