首先要將EnyimMemcached安裝至Windows Performance Counters中。
將Enyim.Caching.dll復制到一個文件夾中
在命令行中進入.NET Framework所在的文件夾——C:\Windows\Microsoft.NET\Framework64\v4.0.30319
用installutil命令進行安裝,比如: installutil d:\lib\Enyim.Caching.dll
安裝成功後,就能在Performance Monitor中看到了。

雖然在counters的列表中出現了,但是下面的Instances of selected object中卻是空白,於是無法將計數器添加到Performance Monitor中。
在配置過程中,在這個地方卡了很長時間。。。
卡在這裡完全是怪自己竟然沒發現EnyimMemcached的幫助文檔:Configure the Performance Monitor。
原來還需要在應用程序中進行配置,要在web.config中添加<performanceMonitor/>的配置:
<enyim.com>
<memcached protocol="Binary">
<servers>
<add address="memcached" port="11211" />
</servers>
<socketPool minPoolSize="50" maxPoolSize="3000" connectionTimeout="00:00:01" deadTimeout="00:00:01"/>
<performanceMonitor factory="Enyim.Caching.Memcached.DefaultPerformanceMonitorFactory, Enyim.Caching" name="www.cnblogs.com"/>
</memcached>
<log factory="Enyim.Caching.Log4NetFactory, Enyim.Caching.Log4NetAdapter" />
</enyim.com>
然後訪問一下站點,將ASP.NET程序啟動起來後,就能在Instances of selected object中看到性能計數器的實例了。

我們選擇一個指標體驗一下:

本欄目