Re: which costs more ?
| From: | Larry Garfield | Date: | Sat, 24 May 2008 17:52:01 +0000 |
| Subject: | Re: which costs more ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-274664@lists.php.net to get a copy of this message | ||
On Saturday 24 May 2008, Feris wrote:
> Hi All,
>
> I need to decide whether to consume feeds from third party as web services
> or just creating my own system with relational MySQL backend.
>
> Question is, which actually cost more ? Parsing a moderate streaming XML or
> creating a mysql connection ? As I read from some sources that creating
> initial connection to mysql is very costly.
>
> Thanks,
>
> Feris
For what definition of "third party"? The cost of connecting to a MySQL
database on the same network segment as the web server will be minuscule
compared to the cost of connecting to a server in another state. (MySQL
connections are actually very fast to set up in PHP; second only to SQLite, I
suspect.)
The cost of parsing the XML will be tiny compared to the network latency. IO
is always your most expensive operation. Caching locally (disk, local MySQL
DB, etc.) can help a great deal, depending on your data.
So the answer is "you've not given enough information to make an intelligent
recommendation". :-)
--
Larry Garfield AIM: LOLG42
larry@garfieldtech.com ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson