[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Chris Szabo

9/25/2004 3:21:00 PM

Hey everyone. If you're a real .Net person this question is going to make
your day... I'm working on a project, and I'm in the initial stages of
design. I wanted to get some feedback on my ideas before I begin any
implementation.

The basic idea is not new. I have a web service that processes inbound
requests. To provide a high level of scalability, the web services interface
with a data access layer via .Net remoting. The DAL is implemented as a
windows service that accepts requests via TCP on a specified port.
Obviously, those requests are then sent to the database, and results are
returned to the web services.

So here are the design considerations:
1. Transaction control - I would like to use Enterprise Services to take
care of transaction control at the application level (web services). Is this
possible when I'm working with .Net remoting.

2. SAO Singelton - There is information that I want to share between all
calls going to the remoting objects. For example, total current requests.
Information like this can allow me to load balance later, and send requests
to identical windows services that are on different servers. As such, I'm
thinking that the best way to implement the remoting object is to use a
server activated object with an infinite lifetime using the Singelton model.
Am I on the right track?

3. Threading - The SAO Singelton model has an inherent problem in that it
creates a bottleneck in the system. I would like to have a main thread that
takes inbound requests and hands them off to worker threads which actually
make the calls to the database. The threads would be in a pool, whose thread
count is defined in a configuration file. How does that sound?

4. Database Methods - I would like to save on memory usage by declaring all
my database methods as static. This way I never have to create a new
instance of the classes that interface directly with the database. I know
the concerns with the associated with Enterprise Services, but the
transaction control would not happen at these methods, so that problem is
solved. Are there concerns with static methods and .Net Remoting?

Thanks everyone, I really appreciate the feedback on this. I know what I'm
doing, but by no means a .Net God. I'm sure some of you out there are
though, so please guide me.

4 Answers

Sam Santiago

9/25/2004 6:17:00 PM

0

See responses below:


> The basic idea is not new. I have a web service that processes inbound
> requests. To provide a high level of scalability, the web services
interface
> with a data access layer via .Net remoting. The DAL is implemented as a
> windows service that accepts requests via TCP on a specified port.
> Obviously, those requests are then sent to the database, and results are
> returned to the web services.

I would suggest reading this article from Marin Fowler on distributed
architectures. It has some good points before you begin development on any
distributed app. Here's nice quote from the article:
"Hence, we get to my First Law of Distributed Object Design: Don't
distribute your objects!"
http://www.sdmagazine.com/documents/s=7897/sdm0304a/sd...

And another good item to review:

Application Architecture for .NET Desiging Application and Services
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/d...

>
> So here are the design considerations:
> 1. Transaction control - I would like to use Enterprise Services to take
> care of transaction control at the application level (web services). Is
this
> possible when I'm working with .Net remoting.

Yes. Chapter 2 of the above MSDN article also states that only the HTTP
channel can be used. See examples in this article:

Applied Remoting
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet05...

>
> 2. SAO Singelton - There is information that I want to share between all
> calls going to the remoting objects. For example, total current requests.
> Information like this can allow me to load balance later, and send
requests
> to identical windows services that are on different servers. As such, I'm
> thinking that the best way to implement the remoting object is to use a
> server activated object with an infinite lifetime using the Singelton
model.
> Am I on the right track?

Yes, sounds fine. You have to watch out for multithreaded issues since a
SAO is multithreaded, so you might have to SyncLock or other threading
control mechanisms. The above article also discusses this.

>
> 3. Threading - The SAO Singelton model has an inherent problem in that it
> creates a bottleneck in the system. I would like to have a main thread
that
> takes inbound requests and hands them off to worker threads which actually
> make the calls to the database. The threads would be in a pool, whose
thread
> count is defined in a configuration file. How does that sound?

Sounds like you're introducing more complexity. Not sure if it will work or
if it's even necessary. Singleton's are already multithreaded to deal with
multiple clients, so you have to deal with thread synchronization issues.
You could also have a factory type scenario where you have an SAO creating
and returning CAOs to handle client respones.

>
> 4. Database Methods - I would like to save on memory usage by declaring
all
> my database methods as static. This way I never have to create a new
> instance of the classes that interface directly with the database. I know
> the concerns with the associated with Enterprise Services, but the
> transaction control would not happen at these methods, so that problem is
> solved. Are there concerns with static methods and .Net Remoting?
>
Static methods are NOT remotable. Check out this link:

Scope of Publication
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconscopeofpubli...

Good luck.

Thanks,

Sam

--
_______________________________
Sam Santiago
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTe...
_______________________________


ToddF

9/25/2004 8:18:00 PM

0

As sam already said, read the article
http://www.sdmagazine.com/documents/s=7897/sdm0304a/sd... and forget
web service and XML if you have an alternative choice.

Regards,


"Chris Szabo" <ChrisSzabo@discussions.microsoft.com> wrote in message
news:E58D0BF0-1188-4A3C-8C7F-1752E3C3B078@microsoft.com...
> Hey everyone. If you're a real .Net person this question is going to make
> your day... I'm working on a project, and I'm in the initial stages of
> design. I wanted to get some feedback on my ideas before I begin any
> implementation.
>
> The basic idea is not new. I have a web service that processes inbound
> requests. To provide a high level of scalability, the web services
> interface
> with a data access layer via .Net remoting. The DAL is implemented as a
> windows service that accepts requests via TCP on a specified port.
> Obviously, those requests are then sent to the database, and results are
> returned to the web services.
>
> So here are the design considerations:
> 1. Transaction control - I would like to use Enterprise Services to take
> care of transaction control at the application level (web services). Is
> this
> possible when I'm working with .Net remoting.
>
> 2. SAO Singelton - There is information that I want to share between all
> calls going to the remoting objects. For example, total current requests.
> Information like this can allow me to load balance later, and send
> requests
> to identical windows services that are on different servers. As such, I'm
> thinking that the best way to implement the remoting object is to use a
> server activated object with an infinite lifetime using the Singelton
> model.
> Am I on the right track?
>
> 3. Threading - The SAO Singelton model has an inherent problem in that it
> creates a bottleneck in the system. I would like to have a main thread
> that
> takes inbound requests and hands them off to worker threads which actually
> make the calls to the database. The threads would be in a pool, whose
> thread
> count is defined in a configuration file. How does that sound?
>
> 4. Database Methods - I would like to save on memory usage by declaring
> all
> my database methods as static. This way I never have to create a new
> instance of the classes that interface directly with the database. I know
> the concerns with the associated with Enterprise Services, but the
> transaction control would not happen at these methods, so that problem is
> solved. Are there concerns with static methods and .Net Remoting?
>
> Thanks everyone, I really appreciate the feedback on this. I know what
> I'm
> doing, but by no means a .Net God. I'm sure some of you out there are
> though, so please guide me.
>


Chris Szabo

9/25/2004 8:39:00 PM

0

Sam,

This is great information. I really appreciate the time you took to help me
out. I will read all of your references carefully.

Thanks again.

"Sam Santiago" wrote:

> See responses below:
>
>
> > The basic idea is not new. I have a web service that processes inbound
> > requests. To provide a high level of scalability, the web services
> interface
> > with a data access layer via .Net remoting. The DAL is implemented as a
> > windows service that accepts requests via TCP on a specified port.
> > Obviously, those requests are then sent to the database, and results are
> > returned to the web services.
>
> I would suggest reading this article from Marin Fowler on distributed
> architectures. It has some good points before you begin development on any
> distributed app. Here's nice quote from the article:
> "Hence, we get to my First Law of Distributed Object Design: Don't
> distribute your objects!"
> http://www.sdmagazine.com/documents/s=7897/sdm0304a/sd...
>
> And another good item to review:
>
> Application Architecture for .NET Desiging Application and Services
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/d...
>
> >
> > So here are the design considerations:
> > 1. Transaction control - I would like to use Enterprise Services to take
> > care of transaction control at the application level (web services). Is
> this
> > possible when I'm working with .Net remoting.
>
> Yes. Chapter 2 of the above MSDN article also states that only the HTTP
> channel can be used. See examples in this article:
>
> Applied Remoting
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet05...
>
> >
> > 2. SAO Singelton - There is information that I want to share between all
> > calls going to the remoting objects. For example, total current requests.
> > Information like this can allow me to load balance later, and send
> requests
> > to identical windows services that are on different servers. As such, I'm
> > thinking that the best way to implement the remoting object is to use a
> > server activated object with an infinite lifetime using the Singelton
> model.
> > Am I on the right track?
>
> Yes, sounds fine. You have to watch out for multithreaded issues since a
> SAO is multithreaded, so you might have to SyncLock or other threading
> control mechanisms. The above article also discusses this.
>
> >
> > 3. Threading - The SAO Singelton model has an inherent problem in that it
> > creates a bottleneck in the system. I would like to have a main thread
> that
> > takes inbound requests and hands them off to worker threads which actually
> > make the calls to the database. The threads would be in a pool, whose
> thread
> > count is defined in a configuration file. How does that sound?
>
> Sounds like you're introducing more complexity. Not sure if it will work or
> if it's even necessary. Singleton's are already multithreaded to deal with
> multiple clients, so you have to deal with thread synchronization issues.
> You could also have a factory type scenario where you have an SAO creating
> and returning CAOs to handle client respones.
>
> >
> > 4. Database Methods - I would like to save on memory usage by declaring
> all
> > my database methods as static. This way I never have to create a new
> > instance of the classes that interface directly with the database. I know
> > the concerns with the associated with Enterprise Services, but the
> > transaction control would not happen at these methods, so that problem is
> > solved. Are there concerns with static methods and .Net Remoting?
> >
> Static methods are NOT remotable. Check out this link:
>
> Scope of Publication
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconscopeofpubli...
>
> Good luck.
>
> Thanks,
>
> Sam
>
> --
> _______________________________
> Sam Santiago
> ssantiago@n0spam-SoftiTechture.com
> http://www.SoftiTe...
> _______________________________
>
>
>

Chris Szabo

9/25/2004 8:41:00 PM

0

Leiyang,

The web services and Xml are only used to process requests from end users.
Once the data has reached the web service it is handed off to the windows
service using binary formatters.

By creating a middle tier that processes Xml for the end users I can
accommodate any platform. But by using binary formatters in the DAL I keep
my performance up.

Thanks for the help!