Skip to content

PageNavigation constructor: 2 seconds delay BEFORE sending the Page.navigate message to the browser (keepAlive problem?) #646

@nevez

Description

@nevez

Hello,

I'm using chrome-php 1.11.0 with "keepAlive" to generate quite a lot of PDFs, the performance I get is a bit on the slow side (2 seconds to navigate to the page, while if I open the page on the browser directly it gets loaded in .2 secs).

So I investigated a bit and found that 99% of the navigation time is spent before even sending the "Page.navigate" message to the browser, it is spent on this line of PageNavigation.php, inside its __construct() method:

        // make sure latest loaderId was pulled
        $page->getSession()->getConnection()->readData();

That readData() triggers an fread() on the socket that lasts almost 1.9 seconds, and returns these bytes (this is only the first part):

......{"method":"Page.lifecycleEvent","params":{"frameId":"4D165D5C6D26BE5D7D19194C6AD3BC43","loaderId":"D14903F279C2FA2B3C7B35E5687F62A1","name":"networkAlm

hexdump of the received buffer: 817e00e97b226d6574686f64223a22506167652e6c6966656379636c654576656e74222c22706172616d73223a7b226672616d654964223a223444313635443543364432364245354437443139313934

Is this kind of delay normal? Is it a problem of chrome responding slowly or the way Wrench handles sockets? Is there anything I can do in terms of chrome command line options or in the way I use chrome-php to reduce this fixed ~2 sec pre-delay?

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions