久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

      <legend id='wKI5Z'><style id='wKI5Z'><dir id='wKI5Z'><q id='wKI5Z'></q></dir></style></legend>

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

          <bdo id='wKI5Z'></bdo><ul id='wKI5Z'></ul>

      1. 完全理解 PDO ATTR_PERSISTENT

        Fully Understanding PDO ATTR_PERSISTENT(完全理解 PDO ATTR_PERSISTENT)

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

              <tbody id='z9rg1'></tbody>

                <bdo id='z9rg1'></bdo><ul id='z9rg1'></ul>

                <legend id='z9rg1'><style id='z9rg1'><dir id='z9rg1'><q id='z9rg1'></q></dir></style></legend>

                <i id='z9rg1'><tr id='z9rg1'><dt id='z9rg1'><q id='z9rg1'><span id='z9rg1'><b id='z9rg1'><form id='z9rg1'><ins id='z9rg1'></ins><ul id='z9rg1'></ul><sub id='z9rg1'></sub></form><legend id='z9rg1'></legend><bdo id='z9rg1'><pre id='z9rg1'><center id='z9rg1'></center></pre></bdo></b><th id='z9rg1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='z9rg1'><tfoot id='z9rg1'></tfoot><dl id='z9rg1'><fieldset id='z9rg1'></fieldset></dl></div>
                • <tfoot id='z9rg1'></tfoot>
                • 本文介紹了完全理解 PDO ATTR_PERSISTENT的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  使用 PDO 時持久連接管理背后的規則/邏輯是什么?

                  What are the rules/logic behind persistent connection management when using PDO?

                  網絡服務器

                  • Windows 7 x64
                  • 雙核,16GB RAM
                  • Apache 2.2.17
                  • PHP 5.3.5
                  • 通過帶有 IP 地址、端口、服務名稱等的 DSN 字符串連接...
                  • 沒有用于 DB conn 的 ODBC(現在已經嘗試創建一個 2 小時了,感謝 Oracle!)

                  數據庫服務器

                  • Linux 上的 Oracle 10g
                  • 具有 4GB RAM 的多核
                  • 專門為我的網絡應用創建的用戶名(是的,它是假的)
                    • 用戶:網絡用戶

                    非持久連接

                    <?php
                    
                    // Open a new connection
                    // Session created in Oracle
                    $dbh = new PDO('DSN', 'webuser', 'password');
                    
                    // webuser is active in v$session with a SID=1
                    
                    $dbh = NULL;
                    
                    // webuser removed from v$session
                    
                    // Manually calling $dbh = NULL; will remove the session from v$session
                    // OR
                    // Wait for script EOL so a kill-session command is sent to Oracle?
                    
                    ?>
                    

                    • 腳本可靠地執行大約需要大約 0.09 秒,框架開銷等...
                    • 持久連接

                      <?php
                      
                      // Open a new connection and make it persistent
                      // Session created in Oracle
                      // Is Apache maintaining some sort of keep-alive with Oracle here?
                      // because I thought php.exe is only alive for the duration of the script
                      $dbh = new PDO('DSN', 'webuser', 'password', array(PDO::ATTR_PERSISTENT => TRUE));
                      
                      // webuser is active in v$session with a SID=1
                      
                      $dbh = NULL;
                      
                      // webuser is still active in v$session with a SID=1
                      
                      $dbh = new PDO('DSN', 'webuser', 'password', array(PDO::ATTR_PERSISTENT => TRUE));
                      
                      // webuser is still active in v$session with a SID=1
                      
                      // Manually calling $dbh = NULL; does not kill session
                      // OR
                      // Script EOL does not kill session
                      // ^^ this is good, just as expected
                      
                      ?>
                      

                      • 腳本在初次訪問時需要約 .12 秒來執行,并帶有框架開銷等......
                      • 后續執行 take ~.04
                      • 我訪問該頁面,webuser 得到一個 SID=1

                        I visit the page and webuser gets a SID=1

                        我的同事訪問了該頁面,webuser 獲得了一個額外的 SID=2 <- 為訪問此頁面的新計算機沖洗、重復和增加 SID

                        My colleague visits the page and webuser gets an additional SID=2 <- rinse, repeat, and increment SID for new computers visiting this page

                        新訪問者不應該重復使用 SID=1 嗎?

                        Shouldn't a new visitor be re-using SID=1?

                        歡迎所有答案、建議、替代測試請求、閱讀材料鏈接.

                        All answers, suggestions, requests for alternate testing, links to reading material are welcomed.

                        我已經使用 RTFM 一段時間了,而谷歌搜索只產生了微薄的持久性與非持久性的優勢博客.

                        I have RTFM'ed for a while and Googling has only produced meager Advantages of Persistent vs. Non-persistent blogs.

                        推薦答案

                        Apaches 的觀點

                        Apache 有一個父進程.此進程創建子進程來處理傳入 Web 服務器的任何請求.Web 服務器啟動時啟動的初始子進程數量由 apache 配置中的 StartServers 指令配置.這個數字會隨著訪問 Web 服務器的請求數量的增加而增加,直到達到 ServerLimit.

                        Apaches point of view

                        Apache has one parent process. This process creates child processes that will handle any requests coming to the web server. The initial amount of child processes being started when the web server starts is configured by the StartServers directive in the apache configuration. The number goes up as needed with a raising amount of requests hitting the web server until ServerLimit is reached.

                        如果 PHP(作為 mod_php 運行,作為 CGI 在腳本執行結束時所有資源都被釋放)現在被告知為請求建立與數據庫的持久連接,即使在腳本完成后,該連接也會保持.現在保持的連接是處理請求的 apache 子進程和數據庫服務器之間的連接,并且可以被這個確切的子進程正在處理的任何請求重用.

                        If PHP (ran as mod_php, as CGI all resources are freed at the end of script execution) is now being told to establish a persistent connection with a database for a request, this connection is hold even after the script finishes. The connection being now hold is a connection between the apache child process which the request was handled by and the database server and can be re-used by any request that is being handled by this exact child process.

                        如果由于某種原因(不要問我確切的原因),子進程被占用的時間比實際請求的時間長并且另一個請求進來,父 apache 進程將此請求重定向到一個(新)子進程,這可能到目前為止還沒有建立到數據庫的連接.如果在腳本執行期間必須這樣做,它會像您觀察到的那樣引發 SID.現在有兩個連接被apache的兩個不同的子進程持有.

                        If, for some reason (do not ask me exactly why), the child process is being occupied longer than the actual request and another request comes in, the parent apache process redirects this request to a (new) child process which may has not established a connection to the database up to this time. If it has to during the execution of the script, it raises the SID as you have observed. Now there are two connections be hold by two different child processes of apache.

                        重要的是要知道,這也會引起很多麻煩.如果在腳本執行過程中出現死循環或中止事務或其他一些甚至不可預測的錯誤,連接將被阻塞且無法重用.也可能發生數據庫的所有可用連接都被使用,但 apache 服務器的另一個子進程試圖訪問數據庫.該進程暫時被阻止,直到數據庫或 apache 釋放連接(超時或自愿終止).此頁面上有關此主題的任何進一步信息:http://www.php.net/manual/en/features.persistent-connections.php

                        It is important to know, that this can also cause a lot of trouble. If there is an endless loop or an aborted transaction or some other may be even unpredictable error during the script execution, the connection is blocked and can not be re-used. Also it could happen that all of the available connections of the database are used, but there is another child process of the apache server trying to access the database. This process is blocked for the time being until a connection is freed by the database or apache (timeout or voluntarily by termination). Any further information about this topic on this page: http://www.php.net/manual/en/features.persistent-connections.php

                        我希望我能正確總結我們在評論對話中討論的所有內容,并且沒有忘記任何事情.如果是這樣,請給我一個提示,我會添加它.:)

                        I hope I got all that we have discussed in our comment conversation summarized correctly and did not forget anything. If so, please, leave me a hint and I will add it. :)

                        我剛剛讀完了這篇評論.它描述了我在上面總結的過程,并提供了有關如何優化 apache 服務器以更好地與持久連接一起工作的有用信息.不過,它可以在有或沒有 oracle 數據庫后端的情況下使用.你應該看看:http://www.oracle.com/technetwork/articles/coggeshall-persist-084844.html

                        I just finished reading the article @MonkeyZeus mentioned in this comment. It describes the process I summarized above and provides useful information on how to optimize your apache server to work better together with persistent connections. It can be used with or without oracle database backends, though. You should give a look: http://www.oracle.com/technetwork/articles/coggeshall-persist-084844.html

                        這篇關于完全理解 PDO ATTR_PERSISTENT的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                        【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)
                  • <bdo id='xbLm2'></bdo><ul id='xbLm2'></ul>

                    1. <legend id='xbLm2'><style id='xbLm2'><dir id='xbLm2'><q id='xbLm2'></q></dir></style></legend><tfoot id='xbLm2'></tfoot>

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

                          <tbody id='xbLm2'></tbody>

                      2. <i id='xbLm2'><tr id='xbLm2'><dt id='xbLm2'><q id='xbLm2'><span id='xbLm2'><b id='xbLm2'><form id='xbLm2'><ins id='xbLm2'></ins><ul id='xbLm2'></ul><sub id='xbLm2'></sub></form><legend id='xbLm2'></legend><bdo id='xbLm2'><pre id='xbLm2'><center id='xbLm2'></center></pre></bdo></b><th id='xbLm2'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='xbLm2'><tfoot id='xbLm2'></tfoot><dl id='xbLm2'><fieldset id='xbLm2'></fieldset></dl></div>

                          • 主站蜘蛛池模板: 亚洲激情综合 | 99re视频这里只有精品 | 久久久久久九九九九九九 | 伦理午夜电影免费观看 | 成年人在线视频 | 综合国产在线 | 日日操日日干 | 色综合网站| 韩日一区二区 | 亚洲精品国产精品国自产在线 | av大全在线观看 | 98成人网 | 免费同性女女aaa免费网站 | 亚洲福利一区 | 蜜桃精品噜噜噜成人av | 国产日韩精品久久 | 黄视频免费在线 | 亚洲一区二区久久 | 亚洲视频免费在线播放 | 一区二区三区在线 | 日韩中文字幕在线不卡 | 日韩精品一区二区三区老鸭窝 | 亚洲视频在线观看 | 欧美精品久久一区 | 成人动漫视频网站 | 国产精品自拍一区 | 欧美淫| 成人久久久 | 日日夜夜天天 | 国产精品视频免费观看 | 色综合久久久 | www.男人天堂.com | 欧美视频在线播放 | 欧美精品在线播放 | 成人精品久久 | 99re6在线视频精品免费 | 欧美日韩在线精品 | 中文天堂在线观看 | 国产一区精品在线 | 成人午夜免费在线视频 | 日韩中文字幕一区二区 |