
內容簡介
現在是時候找出真正造成你的 admin-ajax.php 檔案負載過重的原因了。
與普遍信念相反,對 admin-ajax.php 的負荷不僅僅來自「Heartbeat API」。許多外掛利用 WordPress 內建的 ajax 功能,有時會對網站性能和資源使用造成負面影響。不幸的是,有時很難判斷造成負荷的原因是什麼。
許多部落格和 web 主機建議你安裝外掛來限制對 Heartbeat API 的負荷。雖然這對來自 Heartbeat API 的負荷有很好的效果,但對於使用 admin-ajax 的外掛卻沒有影響。那麼,你如何阻止你看不見的負荷呢?
這就是 Amuga Ajax Log 的用武之地。
Amuga Ajax Log 記錄和追蹤碰到 admin-ajax 的行為。它提供了必要的資訊,例如:
你請求的動作名稱
可能的函式或方法名稱
懷疑的位置
觸發此負荷的頁面
外掛不會追蹤使用者資訊。
Amuga Ajax Log 的目的是協助你更容易地了解是什麼增加了你對 admin-ajax 的使用。外掛將數據記錄到一個純文字檔案或自訂資料庫表格中,並提供易於閱讀的排行榜,顯示哪些行為提高了負荷。
「但繁忙的網站是否會造成大量的追蹤數據呢?」,好奇的當地人問道。
是的,這是真的。這就是為什麼我們不建議長時間啟用外掛。作為故障排除者,你的目標是獲取足夠的資訊來解決問題。憑借排行榜和最近的負荷列表,你有更高的機會追蹤到是什麼造成了你的 admin-ajax.php 重負荷。
Amuga Ajax Log 的另一個不錯的功能是它可以自行清理數據。我們提供了兩個簡單的清理選項。
清除當前的資料庫日誌
從設定頁面中勾選清除當前資料庫日誌的方塊,儲存設定後,Amuga Ajax Log 將清除存儲在資料庫中的所有 admin-ajax 負荷記錄。
停用時刪除所有資料
我們很喜歡提供停用後刪除資料的選項的外掛。Amuga Ajax Log 也一樣。從設定頁面上勾選停用時刪除所有資料的方塊,儲存設定之後,在 Plugins 頁面停用 Amuga Ajax Log 時,該外掛將執行以下操作:
刪除我們的旗標日誌檔案(如果存在)
刪除我們自定義的資料庫表格
從選項表格中刪除我們的數據
一些註解:
請注意,此外掛不會停止 admin-ajax 的負荷,而只是記錄它們並提供相關資訊。你或你的開發人員需要決定接下來該怎麼做。
由於你可以有多個類別共用方法名稱(例如,ILike→Tacos、ILove→Tacos、GiveMe→Tacos),因此可能會有多個位置被列出。
有時,我們無法確定某些負荷的來源。在這些情況下,我們建議使用動作名稱或函式名稱,並使用 SSH 執行 Grep 搜尋,或使用 Notepad++ 等工具進行文本搜尋。
外掛標籤
開發者團隊
原文外掛簡介
It’s time to find out what is really hitting your admin-ajax.php file so much.
Contrary to popular belief, hits to admin-ajax.php do not only come from the Heartbeat API. Many plugins make use of WordPress’ built-in ajax functionality, sometimes negatively impacting site performance and resource usage. Unfortunately, it’s not always easy to tell what is causing these hits.
Many blogs and web hosts will tell you to install a plugin to limit hits to the Heartbeat API. While this is great for hits coming from the Heartbeat API, it does nothing to affect plugins that use admin-ajax. So how do you stop what you can’t see?
That’s where Amuga Ajax Log comes in.
Amuga Ajax Log tracks and logs actions that hit admin-ajax. It gives you a look at essential data, such as:
Requested action name
Possible function or method name
Suspected location
Page that triggered the hit
The plugin does not track information about the user.
Amuga Ajax Log was built to make it easier to see what is really increasing your admin-ajax usage. The plugin logs the data to a flat file or a custom database table. It also provides an easy to read Leaderboard that shows you which actions are hitting the most.
“But won’t a busy site cause a lot of data to be tracked?” asks curious local man.
Yes, that is true. That is why we don’t recommend leaving the plugin activated for extended periods. As a troubleshooter, your goal with this plugin is to obtain enough information to solve your issue. With the Leaderboard and Recent Hits list, you will have a higher chance of tracking down what is hammering your admin-ajax.php file.
Another nice feature of Amuga Ajax Log is that it can clean up after itself. We’ve provided two easy options for cleaning up data.
Purge Current Database Log
From the Settings page, check the box that says Purge Current Database Log, hit Save, and Amuga Ajax Log will clear all admin-ajax hit records it has stored in the database.
Remove All Data on Deactivation
We are a big fan of plugins that provide an option to remove their data after deactivation. Amuga Ajax Log does the same. From the Settings page, check the box that says Remove All Data on Deactivation, hit Save, and when you deactivate Amuga Ajax Log from the Plugins page, the plugin does the following:
Removes our flag log file if it exists
Removes our custom database table
Removes our data from the options table
A Few Notes:
Keep in mind that this plugin does not stop admin-ajax hits; it only records them and provides information about the hit. It is up to you or your developer to determine what to do next.
Because you can have Classes that share method names (ex. ILike->Tacos, ILove->Tacos, GiveMe->Tacos), it is possible that there will be multiple Locations listed.
Sometimes, we can’t figure out where something is. In those cases, we recommend using the action name or the function name and running a Grep search using SSH, or doing a text search with a tool such as Notepad++.
