Parallel RPC framework _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Parallel RPC framework. Yar (yetanotherRPCframework, the instructor asked me why all of them are Ya headers, haha, because the name is so good) I tried to solve a practical problem more than three months ago, one developed PHP extension Yar (yet another RPC framework, the instructor asked me why all of them are Ya's headers, huh, because the name is so good) I was three months ago, to solve a practical problem, the developed RPC framework is different from the existing RPC framework (xml-rpc, soap), which is a lightweight framework, supports multiple packaging protocols (msgpack, json, php), and is parallelized ..

Consider the following scenarios:

Traditional Web applications, a process, and a request, are well handled. However, when a request is processed, it involves multiple data sources and there is no dependency between them.

It is also a traditional Web application. With the rapid growth of the business, the flow of developers will slowly enter a vicious circle, and only addition and subtraction are available for the amount of code. as the system becomes more complex, the system will change the overall situation. The new maintainer does not have that much time to grasp the original system. even with so much time, it is not easy to grasp the combination of the thinking of so many defenders in the past...

In the past, the system will become increasingly unavailable .... When a large application enters this vicious circle, only reconstruction is needed.

So can we decouple this system?

We have already done a lot of decoupling, data, middleware, business, logic, and so on, and various layers. but how can we identify the Web application? MVC has already been done ....

Based on this, Yar may solve these two problems...

Yar is a very lightweight RPC framework. when implementing Yar, I pursue the ultimate lightweight architecture. it is very simple to use. for the Server side:

 
 
  1. class API {
  2. /**
  3. * the doc info will be generated automatically into service info page.
  4. * @params
  5. * @return
  6. */
  7. public function api($parameter, $option = "foo") {
  8. }
  9. protected function client_can_not_see() {
  10. }
  11. }
  12. $service = new Yar_Server(new API());
  13. $service->handle();
  14. ?>

Is it similar to how Soap is used? Yes. in this way, your API class can provide external services ..

Yar binds the document and interface to facilitate development. for the above example, if we use a simple GET request for this interface address, we will see the following information page:


Http://www.bkjia.com/PHPjc/445651.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445651.htmlTechArticleYar (yet another RPC framework, the instructor asked me why all of them are Ya headers, huh, because the name is so good) is my three months ago, in order to solve a practical problem, developed a PHP extension...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.