Caching Query - Unix
This is a discussion on Caching Query - Unix ; Hi,
Its not exactly the subject line, but very simillar !
Multithreaded TCP server, accept request, read some stuff from file/
other server send back response.
during performance we observed Some specific type of request comes
again and again from ...
-
Caching Query
Hi,
Its not exactly the subject line, but very simillar !
Multithreaded TCP server, accept request, read some stuff from file/
other server send back response.
during performance we observed Some specific type of request comes
again and again from various source, and each request causes file open/
read/close (or atleast read) ! and few systemcalls !
the same query i was having before, but got reply "File system will do
it for you" & "dont overoptimized", but now the query,.... can i avoid
those system calls ?
like... Tcp server willl accept request.... Instead of file open, it
will search something in Hashmap (or Cache !) for the request, if this
request is processed recently and having reply in cache...give it from
cache ! (no file read/write)
Note: response and reply is small [like custom made protocol...its
not like we give full webpage into response, its like request +
response length approx. 2048 byte/char.]
Any thought ! any buffer/cache system can use in this ? [Finally can
do with string based threadsafe hashmap...any good suggestion for
that !?]
i already check some proj on SF and googled but unable to makeup !
Thanx in Advance
Raxit
www.mykavita.com
www.yourpoempage.mykavita.com
-
Re: Caching Query
> Any thought ! any buffer/cache system can use in this ? [Finally can
> do with string based threadsafe hashmap...any good suggestion for
> that !?]
First, be sure to test the simplest solution: check the number of
requests that are the most requested, if this number is pretty small,
a single array and linear search may be enough. I am serious, bench it
first.
Otherwise, use your language toolkit (using C++ ?) and check hash
tables or btrees (if C++ std::map).
But be sure to test the simplest scheme.
Note that the hardest part is not the hashing/btree/storage but the
cache management: expiration, how many items to be stored in there
etc.
Note that for general questions (I mean algorithm) you may have better
luck in groups like c.l.c, c.l.c++ or comp.programming.
cheers,
-- paulo