A
A
Alexey Lebedev2014-10-14 10:50:39
SQL
Alexey Lebedev, 2014-10-14 10:50:39

ASP.NET Webcache or SQL which is better?

I thought about three things, but I did not find it in open sources:
1) How long does it take to establish a connection to the database?
2) How long does it take to fetch from cache and add?
3) How long does it take to execute a SELECT?

In general, to the point.
I have from 10 to 80 requests per second with these actions:
1) open a connection.
2) SELECT in 0.02 ms (this data from the top is the most resource-intensive requests)
3) SELECT is performed in 0.03 ms (this data from the top is the most resource-intensive requests)
So, I thought about WebCache.
This is how I use a db connection. Is there something faster?

using (SqlConnection connection = new SqlConnection(connectionString))
    {
        connection.Open();
         ..
    }

I use cache like this:
Cache.Get("key");
Cache.Insert("key", data, dep, DateTime.Now.AddSeconds(3600), Cache.NoSlidingExpiration, CacheItemPriority.High, null);

There are about 10,000 objects in the cache, no more than 1KB in size.
Not overloading, am I so cache?
Well, are you interested in the statistics of those 3 questions and more?
SqlCommand.ExecuteReader
SqlCommand.ExecuteScalar
Here, these would be good to compare.
Still to compare request of a type:
SELECT name FROM users WHERE [email protected];
With stored procedure.
Very interested in research with exact numbers.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RouR, 2014-10-23
@RouR

The problem is a large number of requests. Try to pull out all the data in 2-3 requests. If it doesn't work, then cache as much as possible in memory. 10 MB cache is normal.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question