• <tfoot id='4WfDf'></tfoot>
    <i id='4WfDf'><tr id='4WfDf'><dt id='4WfDf'><q id='4WfDf'><span id='4WfDf'><b id='4WfDf'><form id='4WfDf'><ins id='4WfDf'></ins><ul id='4WfDf'></ul><sub id='4WfDf'></sub></form><legend id='4WfDf'></legend><bdo id='4WfDf'><pre id='4WfDf'><center id='4WfDf'></center></pre></bdo></b><th id='4WfDf'></th></span></q></dt></tr></i><div id='4WfDf'><tfoot id='4WfDf'></tfoot><dl id='4WfDf'><fieldset id='4WfDf'></fieldset></dl></div>

      <bdo id='4WfDf'></bdo><ul id='4WfDf'></ul>

      1. <small id='4WfDf'></small><noframes id='4WfDf'>

      2. <legend id='4WfDf'><style id='4WfDf'><dir id='4WfDf'><q id='4WfDf'></q></dir></style></legend>

        Web 服务器如何处理请求?

        时间:2023-07-16

            <small id='btuHK'></small><noframes id='btuHK'>

              • <bdo id='btuHK'></bdo><ul id='btuHK'></ul>

                  <tfoot id='btuHK'></tfoot>
                    <tbody id='btuHK'></tbody>
                  <i id='btuHK'><tr id='btuHK'><dt id='btuHK'><q id='btuHK'><span id='btuHK'><b id='btuHK'><form id='btuHK'><ins id='btuHK'></ins><ul id='btuHK'></ul><sub id='btuHK'></sub></form><legend id='btuHK'></legend><bdo id='btuHK'><pre id='btuHK'><center id='btuHK'></center></pre></bdo></b><th id='btuHK'></th></span></q></dt></tr></i><div id='btuHK'><tfoot id='btuHK'></tfoot><dl id='btuHK'><fieldset id='btuHK'></fieldset></dl></div>
                  <legend id='btuHK'><style id='btuHK'><dir id='btuHK'><q id='btuHK'></q></dir></style></legend>

                  本文介绍了Web 服务器如何处理请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我使用 php 和 laravel 作为我的网络服务.

                  I use php and laravel as my web service.

                  我想知道在这些情况下 laravel 会存储和处理请求吗?

                  I want to know does laravel store and process requests in these situation?

                  1. 许多用户对不同控制器的请求;
                  2. 来自同一用户的对同一控制器的请求.

                  laravel 是否按照请求到达的顺序将这些请求存储在队列中?

                  Is the laravel store these requests in a queue by the sequence the requests reached?

                  laravel 对不同用户的请求是否并行处理,对同一个用户依次处理?

                  Is laravel parallel process requests for different users, and in sequence for the same user?

                  比如有两个来自用户的请求.这两个请求路由到同一个控制器中的两个方法.虽然服务器端处理第一个请求会花费很长时间,但第二个请求将花费很少的时间.当用户设置第一个请求然后第二个请求时,虽然第二个请求花费的时间很少,但服务器端在处理完第一个请求之前不会处理第二个请求.

                  For example, there are two requests from the user. The two requests route to two methods in the same controller. While the first request will cost a long time for the server side processing, the second one will cost very little time. When a user set up the first request then the second one, though the second one cost very little time, the server side will not process the second request until it finish processing the first one.

                  所以我想知道laravel是如何存储和处理请求的?

                  So I want to know how does laravel store and process the requests?

                  推荐答案

                  Laravel 不直接处理请求,这是由您的网络服务器和 PHP 管理的.Laravel 收到一个已经被你的网络服务器处理过的请求,因为它只是一个用 PHP 编写的工具,它处理与请求调用相关的数据.因此,只要您的网络服务器知道如何执行 PHP 并调用正确的 index.php 文件,Laravel 就会启动并处理它从网络服务器接收到的请求数据.

                  Laravel does not process requests directly, this is something managed by your webserver and PHP. Laravel receives a request already processed by your webserver, because it is only a tool, written in PHP, which processes the data related to a request call. So, as long as your webserver knows how to execute PHP and calls the proper index.php file, Laravel will be booted and process the request data it receives from the webserver.

                  因此,如果您的网络服务器能够接收 2 个不同的调用(通常它们会接收数百个调用),它将尝试实例化 2 个 PHP(子)进程,并且您应该在内存中并行运行 2 个 Laravel 实例.

                  So, if your webserver is able to receive 2 different calls (usually they do that in the hundreds), it will try to instantiate 2 PHP (sub)processes, and you should have 2 Laravel instances in memory running in parallel.

                  因此,如果您的代码依赖于其他代码,根据许多其他因素可能需要很长时间才能执行,您必须在 Laravel 应用程序中自己处理.

                  So if you have code which depend on anther code, which may take too long to execute depending on many other factors, you'll have to deal with that yourself, in your Laravel app.

                  我们通常所做的只是将数据添加到数据库中,然后通过使用数据存储中已有的数据完成的计算得到结果.因此,数据到达数据存储的顺序无关紧要,哪个先进入,最终结果总是相同的.如果你不能依赖这种方法,你就必须准备你的应用程序来处理它.

                  What we usually do is to just add data to a database and then get a result back from a calculation done with data already in the datastore. So it should not matter the order the data get to the datastore, which one got in first, the end result is always the same. If you cannot rely on this kind of methodology, you'll have to prepare your app to deal with it.

                  这篇关于Web 服务器如何处理请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:我如何使用 PHP 实现这个场景? 下一篇:并行执行多个PHP脚本,完成时得到通知

                  相关文章

                • <i id='CtKwO'><tr id='CtKwO'><dt id='CtKwO'><q id='CtKwO'><span id='CtKwO'><b id='CtKwO'><form id='CtKwO'><ins id='CtKwO'></ins><ul id='CtKwO'></ul><sub id='CtKwO'></sub></form><legend id='CtKwO'></legend><bdo id='CtKwO'><pre id='CtKwO'><center id='CtKwO'></center></pre></bdo></b><th id='CtKwO'></th></span></q></dt></tr></i><div id='CtKwO'><tfoot id='CtKwO'></tfoot><dl id='CtKwO'><fieldset id='CtKwO'></fieldset></dl></div>

                  1. <small id='CtKwO'></small><noframes id='CtKwO'>

                  2. <tfoot id='CtKwO'></tfoot>

                    • <bdo id='CtKwO'></bdo><ul id='CtKwO'></ul>
                    <legend id='CtKwO'><style id='CtKwO'><dir id='CtKwO'><q id='CtKwO'></q></dir></style></legend>