Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104437 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 3461 invoked from network); 15 Feb 2019 14:29:04 -0000 Received: from unknown (HELO mail-it1-f182.google.com) (209.85.166.182) by pb1.pair.com with SMTP; 15 Feb 2019 14:29:04 -0000 Received: by mail-it1-f182.google.com with SMTP id l66so12311452itg.3 for ; Fri, 15 Feb 2019 03:12:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=GV4Lu7ZoeEgaI+UTO+Jq7hLN8McmImcvp+Rqhpz45Qw=; b=KXdeWpg8IjrRG58uFLsZbEHnIs13xVsp9ag4VyzhghTTgjCBJODKaRLaKdvBw2rrN2 L5t5dX/KJz9hTKp+JaAWynn+c7JOZ0EnRaikYRCiU4jhI+4n2CHGJLIAuUbT2AqA397u jIDZKswPeyKIM/sFQMHYqwvf/CVMNYrbX2jC8t5hcWJwsbetF8s66ib/yAe1/mMMGMqY ij0hHwSYMLlubfGSHFnJalCm5TX+wnNTA55EtTWv1il5XMZNGBGT4qGs9CPj5/t9OeuO 4qB/vYqR1e4ObpapMdjCOd7D+lEHTQmCh1ns5oH0vGIaRt/1xrDIJ5ojCJQyiqJrc1zr WF0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=GV4Lu7ZoeEgaI+UTO+Jq7hLN8McmImcvp+Rqhpz45Qw=; b=WIsDzQdLDMthX7uMBcLu6mXp2y3lzLuQp3SUszSyfnIH5cKywT5VY0XUdjKmqsvBDA K+qnJqBTH+gwAIeN3SNqko9SCmT6RQyl/MRKBawa8aBzwCh5Ls3AwIkjA7gklfI7TXRO AQxZYouFLdN0lBbxny+v1a1bKFMVhYLdqXegy8bOzvNy8mBq9xdugnNVLtq7OwQF/+46 9ELDt2Dwsb4LCqKPjIWQ/plt4njeb8Zb7s2W8/W1CRBF7JdSuQtbq/d+E9Xq6QbOsWx7 z8FYsmK8MpG4R7Fl1L7Y+g25oha8hYg3wAp0X+8QVqsTz14NGLbjOv6M7ip/LXF8NBs+ 7Qhw== X-Gm-Message-State: AHQUAuYjFhd/5Q8dOz64rjhu9eUbMDBQlEYxEGwRt9/8Dd6+qyiPuFEq npVgYn24PFxO673OyNNKCmBVOtuQdwcckwHIqrpWLQ== X-Google-Smtp-Source: AHgI3IaudAvYHfdoeKfvd9Rl4vVlyfgAykGAy7xy6g4rJTUaNGxu+aM0wRPXf8P6dryS2Z2LFD5FnSfJv/yxuZmRPtQ= X-Received: by 2002:a5d:8946:: with SMTP id b6mr4845657iot.231.1550229160713; Fri, 15 Feb 2019 03:12:40 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 15 Feb 2019 11:12:29 +0000 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="00000000000071e1e20581ecda7b" Subject: Re: [PHP-DEV] Re: ZTS improvement idea From: rowan.collins@gmail.com (Rowan Collins) --00000000000071e1e20581ecda7b Content-Type: text/plain; charset="UTF-8" On Fri, 15 Feb 2019 at 07:26, Benjamin Eberlei wrote: > This is like the 80% use-case of threading, Multiple HTTP requests, multiple long running SQL queries. An API like parallel would allow each and everyone of us to make controllers faster today without a large effort. > > I think an expanded example would better demonstrate the power of this. Consider a search API that aggregates other search APIs; for each API, it will need to do several steps: - Look up code mappings in a DB to convert input into format needed by this API - Perform an auth request to get a fresh token - Send the search API call - Look up more code mappings to convert the response - Post-process results into a standard form The challenge is to call as many APIs as possible at once, and get the results to the user. The slow parts of this are mostly I/O bound, but to take advantage of async I/O you need to rewrite not just the I/O parts but the entire process to use some async framework. Maybe there's even parts that are CPU heavy in between the requests - a complex cryptographic algorithm, for instance - that async I/O wouldn't help with at all, but which could happen on separate cores when load was low. It would be absolutely amazing if you could use something like Joe's new parallel extension to handle this workload: run the handling of each API as a thread, and leave the code inside them entirely unchanged. I realise it's probably not as simple as that in practice, but to me, the ability to adapt existing code is a huge benefit of a straightforward parallel/thread/worker API over one based explicitly on async I/O. Regards, -- Rowan Collins [IMSoP] --00000000000071e1e20581ecda7b--