Bad performance file_get_contents with PHP, only on linode

Hi,

I have a local test vmware image running Ubuntu 8.10 server.

My linode is also Ubuntu 8.10.

They are both set up almost exactly the same (I have a step by step almost script like template to set up a new server).

I'm using php filegetcontents to download (small ~ 15kb) files from websites.

The thing is, that my test vm, behind a crappy bargain basement adsl connection, performs far better than my Linode.

My test machine looks like its doing 1 file per second or thereabouts. My linode looks like its averaging 1 file per 3 seconds.

Any idea what could be the prob? I don't have a high powered test machine, its running under vmware sharing my 2.4ghz laptop. And besides, this isn't exactly disk or cpu killing stuff!

The php.ini files should be the same on both machines. HTTP network timeout in the context on both is set to 1. Linode appears to be pausing for far far longer though. And also appears to be taking longer on successfull tries too.

Is there some kind of bandwidth limiting going on? My linode performance charts in the console seem fine and unloaded.

3 Replies

Hmm..

Already found that I should probably be using curl instead anyway.

http://stackoverflow.com/questions/5555 … erformance">http://stackoverflow.com/questions/555523/filegetcontents-vs-curl-what-has-better-performance

That doesn't explain the bad linode performance yet. Though I will change the getcontents function to curl tomorrow and test.

This looks interesting and points to the possibility of slow dns servers.

http://stackoverflow.com/questions/7350 … erformance">http://stackoverflow.com/questions/735091/php-filegetcontentsurl-slow-performance

Performance over a large number of records (10K) is 1 download every 5 seconds.

I'm going to rewrite this in python so I can multithread.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct