Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ask for advice for data access design pattern

0 views
Skip to first unread message

George

unread,
Oct 11, 2008, 9:18:00 AM10/11/08
to
Hello everyone,


I am designing a library which client side could use it to retrieve content
from a remote cache server, through Http/Web Services communication.

My current issues and concerns are,

- I want to let client side library to start multiple threads to work
efficiently to request for multiple content at the same time other than a
single thread pattern;
- But I do not want to hit the server too hard and I also do not want to the
library to consume too much resources (memory/threads) on client side to
block other work of the client. The library is delivered as a DLL, so loaded
into client side process, and will compete for resources of the same process.

Are there any good design patterns for such issues?


thanks in advance,
George

Alex Blekhman

unread,
Oct 12, 2008, 10:14:57 AM10/12/08
to
"George" wrote:
> - I want to let client side library to start multiple threads to
> work efficiently to request for multiple content at the same
> time other than a single thread pattern;

The common solution for this problem is to use I/O Completion
Port. Read more about IOCP here:

"I/O Completion Ports"
http://msdn.microsoft.com/en-us/library/aa365198(VS.85).aspx

Very nice IOCP sample:

"A simple IOCP Server/Client Class"
http://www.codeproject.com/KB/IP/iocp_server_client.aspx

HTH
Alex


Tim Roberts

unread,
Oct 13, 2008, 1:18:32 AM10/13/08
to
George <Geo...@discussions.microsoft.com> wrote:
>
>- I want to let client side library to start multiple threads to work
>efficiently to request for multiple content at the same time other than a
>single thread pattern;
>- But I do not want to hit the server too hard and I also do not want to the
>library to consume too much resources (memory/threads) on client side to
>block other work of the client. The library is delivered as a DLL, so loaded
>into client side process, and will compete for resources of the same process.
>
>Are there any good design patterns for such issues?

To a certain extent, this is a problem that solves itself. If your server
gets too many requests, it won't be able to serve them all, and things will
slow down.

Remember that web servers can handle hundreds of requests per second. It
takes an awful lot to bring down a server.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

George

unread,
Oct 13, 2008, 10:10:02 AM10/13/08
to
Hi Alex,


As far as I know, IO completion port is server side solution to serve client
request efficiently.

What I am doing is at client side. I am not sure whether IO completion port
serves my needs. Any comments?


regards,
George

George

unread,
Oct 13, 2008, 10:13:02 AM10/13/08
to
Thanks Tim,


I read your reply but confused -- "this is a problem that solves itself".
Could you clarify what is your solution please? In my original reply, I only
states my concerns and problems, no solution from my mind -- and this is why
I come here to ask experts like you. :-)


regards,
George

Tim Roberts

unread,
Oct 15, 2008, 1:22:20 AM10/15/08
to

What I'm suggesting is that you take a straightforward approach and see
what the impact is. You are trying to optimize things before you know
whether you have a problem. Assuming you are writing a real program, I
doubt that your application will be able to swamp one of today's web
servers.

George

unread,
Oct 15, 2008, 7:23:01 AM10/15/08
to
Thanks for your advice, Tim!


I totally agree, I just want to read more from best practices before my work
and I also want to see whether there are any existing samples or something --
so that I do not re-invent the wheel.

Any recommended documents?


regards,
George

0 new messages