Asp.net Cache vs memcached

Source: Internet
Author: User

I. Environment Server: IBM X365 M3 8 Core 8G RAMOS: windows server 2008 r2 & Hyper-V + CentOS 6.2 ii. Code (1) Subject code, easy to read: [csharp] SqlDataAdapter DataAdapter = new SqlDataAdapter (); SqlConnection Conn = new SqlConnection (DataConn); Conn. open (); SqlCommand myCommand = new SqlCommand (SQL, Conn); DataAdapter. selectCommand = myCommand; DataAdapter. fill (ds); Conn. close () (2) Memcached (Client: BeITMemcached) [csharp] cache. sendReceiv ETimeout = 5000; cache. minPoolSize = 2; cache. maxPoolSize = 5; string cached_dt = cache. get (key) as string; if (cached_dt = null) {// subject code string str_dt = DataTableXml. serializeDataTableXml (ds. tables [0]); cache. set (key, str_dt, 30);} else {ds. tables. add (DataTableXml. deserializeDataTable (cached_dt);} (3) Asp.net Cache [csharp] view plaincopyif (HttpContext. current. cache [key] = null) {// subject code Http Context. current. cache. insert (key, ds, null, DateTime. now. addSeconds (30), System. web. caching. cache. noSlidingExpiration);} else {ds = (DataSet) HttpContext. current. cache [key];} III. Test Tool and parameter AB-t 30-c 50 192.168.0.226/t. aspx Description: t. aspx page reads Dataset 24 times, for (int I = 1; I <= 24; I ++) 4. Result (1) MemcachedRequests per second: 293.53 [#/sec] (mean) Time per request: 170.343 [MS] (mean) (2) Asp.net CacheRequests per second: 2408.06 [#/sec] (mean) Time per request: 20.764 [MS] (mean) v. Conclusion Memcached may have a high performance loss compared with LocalCache in Object serialization and network! Reference: Cache Type Cache Gets/sec Array Cache 365000APC Cache 98000 File Cache 27000 Memcached Cache (TCP/IP) 12200 MySQL Query Cache (TCP/IP) 9900 MySQL Query Cache (Unix Socket) 13500 Selecting from table (TCP/IP) 5100 Selecting from table (Unix Socket) 7400

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.