Parallel RPC Framework _php tutorial

Source: Internet
Author: User
Tags vars
Yar (yet another RPC framework, the leader asked me why are ya head, hehe, because this name is good) is I 3 months ago, in order to solve a practical problem, and developed a PHP extension, RPC framework, and the existing RPC framework (XML-RPC, SOAP), this is a lightweight framework that supports a variety of packaging protocols (Msgpack, JSON, PHP), and one of the most important features is that it is parallelized.

Consider the following scenario:

A traditional Web application, a process, a request, is justified. However, when a request is processed, more data sources are involved, and there is a certain degree of non-dependence between them.

or traditional Web applications, an application with the rapid growth of the business, the flow of developers, will slowly enter a vicious circle, the code of the amount of only add no subtraction. Because as the system becomes complex, the lead will move the whole world, and the new maintainers, the original system and not so much time for him to master. Even with so much time, it is not an easy thing to master the combination of so many defenders ' thinking.

Well, long time before, this system will become more and more non-maintainable .... To a large application into this vicious circle, then all that awaits him is refactoring.

So, can you decouple the system?

We've done a lot of decoupling, data, middleware, business, logic, and so on, all kinds of layering. But to the Web application of this piece, how can you divide it, mvc we have done ....

Based on this, Yar may be able to solve the two problems you encounter ...

Yar is a very lightweight RPC framework, and when I implement Yar, I pursue the ultimate in lightweight, which is very simple to use for server side:

 
 
  1. class API {
  2. /**
  3. * The DOC info would 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. ?>

Very similar to SOAP usage? Yes, in this way, your API class will be able to provide services to the outside.

Yar to facilitate development, the document and interface binding together, for the above example, if we are simple GET request this interface address, we will see the following information page:


http://www.bkjia.com/PHPjc/445651.html www.bkjia.com true http://www.bkjia.com/PHPjc/445651.html techarticle Yar (yet another RPC framework, the leader asked me why are ya head, hehe, because this name is good) is I in 3 months ago, in order to solve a practical problem, and developed a php extension ...

  • Related Article

    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.