Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125911 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 3B64B1A00BD for ; Tue, 5 Nov 2024 16:50:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1730825594; bh=PsUQIQ/gVwsscPK1qUtgTkXqr4/MRlXyuZHcvjcES2A=; h=References:In-Reply-To:Reply-To:From:Date:Subject:To:From; b=YvXU1i85MPZnEsUqBh+2A2UYmjmw6O+7SxVYbhtn5ibF4WEV0D7DPS7goaJcz+i8o r2Nlgxhm6I4sC/9Q7AlvuNtEXkWtg7fPaXvwQd1p9fbVKXHkbjK4IA/bKVsOu9Qfup XauMIU4h1h2dS4Crr96mk861kPb/vHapbsV8Wl0TaDshAbLEdBMtWt+HLD2kWDcB7N yW1PXpybIwTpXtRwXYdhe/QcCA02TKfEfykYyRsRjEJsJG/lyhNim4/aVJzDJqW911 /d75TRjfilHkfOV1IvwsobVcHBGH+nKj8Fbt0KDwXO9YiFYomnjnrkieacoduhzZFM Ef73zKxLQEIoQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1605B180078 for ; Tue, 5 Nov 2024 16:53:14 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, FREEMAIL_REPLYTO,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) (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 ; Tue, 5 Nov 2024 16:53:13 +0000 (UTC) Received: by mail-il1-f181.google.com with SMTP id e9e14a558f8ab-3a6aed064b8so17357255ab.0 for ; Tue, 05 Nov 2024 08:50:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730825441; x=1731430241; darn=lists.php.net; h=content-transfer-encoding:to:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PsUQIQ/gVwsscPK1qUtgTkXqr4/MRlXyuZHcvjcES2A=; b=Lzbqmf3bV2VLzQ+Ye1v4CmCaMMAJwc3hMGQygFbCVirijIDy+zOixk1Y30Uku+2/Xw yjnFrn2AmjLF/qn2BIhdA9vi4nvZlAQQbQDMcg+nMg5tfBIvpxIqbJryJtEr5V9mL6Ug qhgYGmmq5v5ch6mVktIiGRpYKstdHal9xI0RhTfyf2djiWb5EcLV+O+wqAALvNiXy9Ij amxRxeCpHGQm5SUwjMZ/Ed2g1Y1g0Mu6cxqyhGiWoD33xXrazuO1o2Kp2dZ2xqtcgaXj zoB8AW4Bc2AuUNecFQTRc3PmtTPdfLjOX7kQxDOaWQILjIQer4LBPNLCv+QfZTyuUQHP fwqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730825441; x=1731430241; h=content-transfer-encoding:to:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PsUQIQ/gVwsscPK1qUtgTkXqr4/MRlXyuZHcvjcES2A=; b=uRH+9S50oPJDRsbYe9RJdRpEBYjSI135X05Nr/wJXMbg6sx1jthPxObK6o5kAnWaiK AX0xSyFlnAvuAgNQFah5+NUYIDL/PtS8Ad5dSTzS95JpXktFgKStMfkj9d2eCOGbstDQ zSTiesqnyox2gNms4/FxuW21C5A2Byrdx1zvgjd1rbdghcwpKDmsYOXkpZxChY0QAA+D 13mx7e+G4cm1zUPRiwkbqgV9CKQg5BRmz7I0ZV7z0Oi0Bh/upoFj+fqxky0Cojz3Fvsg W4iSiviTsvMUhqaLJYm6o2PyNZRb1QNXmU28pK96AC6wfD8n/WK9eKg4Namc4rOuTiDQ DCkQ== X-Gm-Message-State: AOJu0YxxuoceTekcYZzvcsc7+yQX2AJ3t1ailXKKrOVuBiqRSZuPFcG0 J385CUg5YcK9cpJ2Iww5kswztFagzAnfdegpzzDKHEEdal1UwQZgf8rUtJ8wwpfj0gWzmf6ahf5 S/jajeghjx7VdyaChreVAqY6DreQAJg== X-Google-Smtp-Source: AGHT+IH2d8Uuogbzm3jB0GXi/f+uPL8Ls5FIyuTEM09yQsPSqo6QU4IOkIBkvYmadnwW0EYRatqxm3FVboXy+Hf7xs4= X-Received: by 2002:a92:c566:0:b0:3a1:a20f:c09c with SMTP id e9e14a558f8ab-3a6b0358264mr178462535ab.22.1730825441218; Tue, 05 Nov 2024 08:50:41 -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: Reply-To: erictnorris@gmail.com Date: Tue, 5 Nov 2024 11:50:25 -0500 Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Persistent CurlShareHandle objects To: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: eric.t.norris@gmail.com (Eric Norris) On Mon, Nov 4, 2024 at 2:13=E2=80=AFPM Jakub Zelenka wrote: > > On Mon, Nov 4, 2024 at 2:21=E2=80=AFPM Jakub Zelenka wrot= e: >> >> 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 i= ncludes mysqlnd, redis and its other users) are quite primitive and not tha= t well managed. This might occasionally result in incorrect clean up and po= ssibly 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 co= nnections. For extension it could work by registering the pool with some co= nnect 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 pote= ntially 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 concep= t 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 event= ually need for streams if they ever get them converted to objects. There ar= e likely many application successfully using persistent resources and it co= uld 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. >> > > Just for the reference I voted yes on RFC because that's just about the c= oncept and user API which I think is fine and it's inline with persistence = that we already have. But note that it doesn't mean that we will accept imp= lementation in the current form. Thank you for your feedback, and for your vote! I'm open to implementation changes, so feel free to leave comments on the pull request in the event this passes. I'm also open to your idea of having a connection pooling mechanism in the SAPI, and would be interested in helping draft that as an RFC if that is necessary. I had noted something like this in the 'Future Scope' section of this RFC, but wanted to aim small since this was my first RFC. Eric