Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125906 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id A081B1A00BD for ; Mon, 4 Nov 2024 13:21:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1730726659; bh=HhdikgyaX7cfAbHbWuduRF6MvTpQgSsYSTI69251ygY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=IYSezWitHtHZBEgBUu36o+BaZsMcF/ADpON1IYZ4Ia+UKBZ45l7hHJ4g3UZzMNfhT lxiviA081rtFcdbaO/F/dERi7U7LQQcQYMOufItxZtI+UHurOGf5I20ufWRAcral34 sk5Srel3oxCa4UpnN3m0WzNnwwKrR00O1U5obA8pjFh9jYmb7FzJ2MrLyrsn0PLwg0 MjQIBZzCo6RKgaWIiLixinEHZOQpACh30cta09/G0s6VKxm2DF+e7z8I6yBYQwa6ab hIm7qXmkk5TLkck2iTf1PLUn1Dfk8Z3RD2+YDunfXnZZikLKum3z7zROjRVVXLnIj8 +llmnKwTvOXsw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EC83D180037 for ; Mon, 4 Nov 2024 13:24:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.7 required=5.0 tests=BAYES_50,DMARC_NONE, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 4 Nov 2024 13:24:17 +0000 (UTC) Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-71815313303so2021692a34.1 for ; Mon, 04 Nov 2024 05:21:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730726506; x=1731331306; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HhdikgyaX7cfAbHbWuduRF6MvTpQgSsYSTI69251ygY=; b=uCJ9PtTLuqouRFFRkBU+TC08YY/KKi39NpKZbDPn7T/K9KlfQx3gWtKiBvBZwP/oUA eWHoaLDEbCVlCHpNwE/artpBXz989FLbZQISkmxM55hlmcE+UCn3/e5DVBjdLHO4CJ39 Mce9inp//aetDz+kvYdXvSM4T77ehoDuVl7B0Y3kOswOlbUtgGtsGnvQ/2/PTm3ZKMO3 GgfONAB0Ve9npYt+iSvW7pGlwY9K6jpdcSGSgRpdMXm4eWNKlWQRRrPij7C5XfcdBzKA bycfNp10TfgoeOqtz92cXzMiknRgMA/9OfTd8cq5gdv4JWO0DyuFDerz5iF1tHOE6b14 GLlw== X-Gm-Message-State: AOJu0Yx5urfx8gxklaSKMDyVFelwQ5fBpWQrEN561P6Ijs1LzRDq7aA/ DnsqM+I3Hsh3wVY0jRyrzobTcxKOlq6viU5eYInN5aQhMJ3IpDcRVni+lsbobqOSFfc20mAzI2k w2N5eewui5w0JPmFx9GHNbqvaVqIldA== X-Google-Smtp-Source: AGHT+IEDGCer1J4FSalDvTLEsOrQk2WZzkwiBsSF5Rtwou+NbAdZtDPJ4NWdcZQcEP1uGgFvbFBGVhLH3h3eToFwx7M= X-Received: by 2002:a05:6830:6c8c:b0:718:9f5c:7b43 with SMTP id 46e09a7af769-7189f5c7be4mr8842154a34.1.1730726505735; Mon, 04 Nov 2024 05:21:45 -0800 (PST) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 4 Nov 2024 14:21:34 +0100 Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Persistent CurlShareHandle objects To: erictnorris@gmail.com Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000093ee9e0626162ae3" From: bukka@php.net (Jakub Zelenka) --00000000000093ee9e0626162ae3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Wed, Oct 9, 2024 at 10:18=E2=80=AFPM Eric Norris wrote: > Hello all, > > After receiving some feedback about > https://github.com/php/php-src/pull/15603, I'm formally proposing an > RFC to add persistent curl share handles here: > https://wiki.php.net/rfc/curl_share_persistence > > I think what's really needed for this is to have some infrastructure for connection pooling. The current persistent connections in streams (which includes mysqlnd, redis and its other users) are quite primitive and not that well managed. This might occasionally result in incorrect clean up and possibly having too many connections open. What I think we need is a new internal API that would be handled by SAPI. So basically some generic API that SAPI would hook into and manage the connections. For extension it could work by registering the pool with some connect and clean up callbacks and various parameters (e.g. timeout and maybe something else). Then it would be just getting the connections from it. It should be quite generic so it can support also curl handles so the actual connection should be opaque. The point here is that SAPI should handle the pool and deal with timeouts / clean up. This could work pretty well for the threaded SAPI's. FPM is a bit limited as it's per worker but it could potentially set its own limits and could still better handle timeouts and clean ups. I think there should be not such a big oppositions to the general concept because this is already rooted in PHP in the form of persistent resources and this just tries to implement the same for objects which we might eventually need for streams if they ever get them converted to objects. There are likely many application successfully using persistent resources and it could be quite problematic to drop the whole concept. Basically what I want to say is that we have got chance to implement it properly for objects and we should not end up with the same sort of way how it's done currently for resources. The better way is to have SAPI managed API IMHO. Regards Jakub --00000000000093ee9e0626162ae3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

On Wed, Oct 9, 2024 at 10:18=E2=80=AFPM Eric Norri= s <eric.t.norris@gmail.com> wrote:
Hel= lo all,

After receiving some feedback about
https://github.com/php/php-src/pull/15603, I'm form= ally proposing an
RFC to add persistent curl share handles here:
https://wiki.php.net/rfc/curl_share_persistence

I think what's really needed for t= his is to have some infrastructure for connection pooling. The current pers= istent connections in streams (which includes mysqlnd, redis and its other = users) are quite primitive and not that well managed. This might occasional= ly result in incorrect clean up and possibly having too many connections op= en.

What I think we need is a new internal API tha= t would be handled by SAPI. So basically some generic API that SAPI would h= ook into and manage the connections. For extension it could work by registe= ring the pool with some connect and clean up callbacks and various paramete= rs (e.g. timeout and maybe something else). Then it would be just getting t= he connections from it. It should be quite generic so it can support also c= url handles so the actual connection should be opaque. The point here is th= at SAPI should handle the pool and deal with timeouts / clean up. This coul= d work pretty well for the threaded SAPI's. FPM is a bit limited as it&= #39;s per worker but it could potentially set its own limits and could stil= l better handle timeouts and clean ups.

I think th= ere should be not such a big oppositions to the general concept because thi= s is already rooted in PHP in the form of persistent resources and this jus= t tries to implement the same for objects which we might eventually need fo= r streams if they ever get them converted to objects. There are likely many= application successfully using persistent resources and it could be quite = problematic to drop the whole concept.

Basically w= hat I want to say is that we have got chance to implement it properly for o= bjects and we should not end up with the same sort of way how it's done= currently for resources. The better way is to have SAPI managed API IMHO.<= /div>

Regards

Jakub
=
--00000000000093ee9e0626162ae3--