English 中文(简体)
3. 建立可观的网络服务
原标题:Building highly scalable web services

我的团队和我正在拟定一份需要能够处理高压运输的申请。 不是面对面的,但将来,我希望能够扩大规模,而没有大规模重新制定法典。

我的想法是,把所有东西组合起来,把服务与自己的接口结合起来。 因此,例如,信息发布会有一个信息传送界面,这些接口可能已经作为方法发送和获得Messages,而PHP的网络数据只是通过肥皂或曲线或像这样的东西来质疑这一接口。 因此,电传应用可以是任何类型的应用,这样, Java申请或 Python形或适合这一特定功能,而其本身的数据库则很硬。

这种做法是否好?

最佳回答

Modularise

My thought was to modularise out everything into seperate services with their own interfaces. So for example messaging would have a messaging interface that might have send and getMessages() as methods and then the PHP web app would simply query this interface through soap or curl or something like that

我赞同在服务单元(良好编码原则)中将每一个单元分开的想法。 我不喜欢关于SOAP的部分: 我认为,这是复杂的。 我要谈谈如下内容:JSON-RPC或一些。

Some quick tips:

My team and I are in the middle of developing an application which needs to be able to handle pretty heavy traffic. Not facebook level but in the future I would like to be able to scale to that without massive code re-writes.

  • Like the others also hinted I would advice you to look at High Scalability blog.
  • First focus on the front-end using YSlow / google page speed. This optimization are easy to implement and can give you significantly boosts. A quote from the Yslow webpage:

80% of the end-user response time is spent on the front-end. Most of this time is tied up in downloading all the components in the page: images, stylesheets, scripts, Flash, etc. Reducing the number of components in turn reduces the number of HTTP requests required to render the page. This is the key to faster pages.

  • I would also advice you to have a look at HipHop for php which converts your php code to C code which was a huge boost for facebook. A quote from the article:

With HipHop we ve reduced the CPU usage on our Web servers on average by about fifty percent, depending on the page. Less CPU means fewer servers, which means less overhead

  • I guess another big/easy improvement if not already setup is to use APC(opcode cache) to cache your compiled code. This will give you a huge boost(not necessary for the parts converted to HipHop).
  • 如果你想要你的网站能够扩大你们的面孔:

    < Cache, cache, cache! with for example CA, memcadated/a>,redis

  • First profile your PHP code then optimize low hanging fruit. I found this audio file from Rasmus Lerdorf really useful. When reading the blog post you will find a lot of good tips to improve performance.
  • Also I would consider moving away from the relation database in favor of for example Cassandra. This is a move which I see a lot of big players do recently(for example twitter, digg, facebook, reddit). You will have to go in a complete different mindset this way, but my bet is this will totally be worth the effort.
  • Queue everything and delight every one with for example beanstalkd, gearman or google app engine s taskqueue.
问题回答

这种声音作为第一步是合理的,仅仅铭记着植物检疫层和电离层之间的交通,就会增加一个相对的界限。 也可以考虑:

  • 使用(例如)。 您也可考虑使用网页“Proxy Cache”,例如squid

  • 举例来说,通过将会议数据储存在数据库中,将网站服务器提升到一个以上的机器。 一旦你能够支持拥有2个网络服务器,就应当增加第3个(第四、第五等)服务器。 铭记您可能最终需要将电离层扩大到多台机器。

  • 利用PHP e-Accelerator等工具,收集各种文字;应当帮助提高网络层面的业绩。

http://highscalability.com/“rel=“nofollow noretinger”>High Scalability 同样,你可能认为这是有益的。

最后,铭记解决办法过于简单。 您的最好用心是不断衡量负荷、业绩、资源利用等情况,然后利用这些数据进行必要的调整。

Cache, cache, and more cache. 避免在同一件事中多次提出质询。 然后,在您的行程中,使用一位简介员,跟踪你们的缓慢点。

围绕一套模块进行高层次设计,是管理复杂性和结构发展(不过,在微观一级更是这样)的良好途径。

PHP的网络数据将简单地通过肥皂或曲线查询这一接口。

这在申请中引入了许多相对性。 我建议对APIC作出定义,但对于任何按顺序处理的请求,在尽可能的单一校对中操作该法典的大部分。

如果你必须处理多种发展语言,使用吉大港山区开发方案的接口,是一种非常务实的解决办法,但如果你重新在价格指数中发展前端,然后将方案拟定成一个抽象的购买力平价(可能称作Sap、Corba或其他 st子),你仍然可以选择以不同的方式执行后盾。

我不敢肯定你通过我所说的话。 如果你再谈论像时代的要求处理,那么你需要考虑如何在购买力平价中安装用户。 这完全是worm虫——我没有看到在PHP中书写的良好信息处理系统,但我看不出在贾瓦邦书写的很好的可衡量的解决办法,其中包括一些主要参与者在高端系统中制造的产品。 也许有一天我写了一封信;在此期间,你真的希望保持你复杂的(而且可能不太可靠)业务逻辑,使之与任何形式的订阅者“mon魔”保持同步,这样,显然就是要把目标放在一个网页上,让订阅者成为一种mon魔,简单地收集信息和打电话给网上推销器。

页: 1 如果大家对业绩/可靠性/可衡量性感到担忧,那么不要把同步的系统建立在信息上。

HTH

C. 出席情况





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签