简体   繁体   中英

simplexml_load_file slower between different servers?

I have tested the exact same code on two different AWS servers with a similar set-up and configuration, and the code on Server B is drastically slower in returning data from simplexml_load_file .
They are both quite active sites (50-60 calls to this page per minute), but no errors are showing up in logs.
Does anyone know if there are any apache or php configuration changes that I could look into changing on the slower site to remedy this?

The line causing the bottleneck is very simple:

$data = simplexml_load_file($url);

I would be grateful for any guidance that could be provided.

I don't think simple xml is that slow, it's slow because it is a parser but I think the 1000 curl/file_get_contents are taking a lot more time. Also why don't fetch the data and just use simplexml_load_string, do you really need to put those file on the disk of the server ?

At least loading from memory should speed up a bit things, also what kind of processing are you going on the loaded xmls ? are you sure you processing is efficient as it could be ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM