开发者

Fastest way to process php & mysql?

I am looking for any kind of way to process php & mysql faster than my MacBook Pro running XAMPP is able to do.

I have written an application, that has to process a lot of data for so开发者_运维百科me simulations. On my MB, this takes about half an hour each time I want run a simulation. Not so very handy.

Is there a good (and cheap) way to process these simulations a bit faster? I already enabled MySQL-Caches and PHP eAccelerator - but it's just simply too slow. I'd love a service, where I could place some MySQL-DB, some PHP and gain a lot of processing-power.

Is there something faster than XAMPP to tun this?


Generally speaking, performance is difficult to determine without going into details about your implementation so I can't really offer much advice beyond a few tips:

As the commenters mention, PHP isn't designed for number crunching; something like Python, Java, or C++ are far better suited to this kind of task.

Is 30 minutes a reasonable amount of time for the task to take? Assuming it takes 10 minutes less, will that actually be worth spending money on? Better planning and running jobs overnight is far cheaper :)

As far as alternatives go you could try running your jobs on an Amazon EC2 instance, which may give you a bit of a speed boost but you'll still be running on one core; so your simulation will run roughly as quickly, ignoring input/output.

If you actually want to optimise it, profile your application. You need to know where the time's being spent so you can figure out which parts you should spend time optimising; once you know which part of the code takes so long you should be able to try different approaches to get it working faster. Make sure you know the quirks of PHP, there are some surprising performance differences you might not be aware of. Optimisation can help, but always make sure your time spent doing it is going to be worth the time it saves.


You could rent some processing power from a hoster.

You should however find the source of the slowness. Analyze the points that take a lot of time. Is it disk access? Try a memory cache. Are the queries slow because they don't hit indexes for examlpe? Analyze and improve your queries. Does your code use massive loops of querying which could be done in a join? Then use a join.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜