On Thu, 21 Jan 2016 22:21:31 +0530 Deepak <dpb795795 at gmail.com> wrote:
> How can improve the service performance here? Keeping in mind, > > > - There will be no new inserts (ignoring addition of few hundred > URLs once a day while overwriting the older ones). Size of the DB > will be more or less constant in range 1-2MB or at most 5 MB. > - Most of the times service is reading values. > - Another service update some of these settings. (say once an hour) > > > Intention: > Super fast response to the user. >From your description, I honestly think you're barking up the wrong tree. How fast is it now, and how fast would "super fast" be? How much complexity are you willing to tolerate to get there? To answer your question: since the data are updated infrequently, you could build your own cache in program memory using a data structure of your own choosing. A hash table, for instance, has O(1) performance and no I/O. Keeping 5 MB of data in memory and hashing the keys is well within the capacity of most Windows systems. You can even use WaitForSingleObject to recognize when the cache needs to be rebuilt. --jkl