473,320 Members | 1,988 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Using a Web Service for Business Logic BackEnd / Data Layer

Hi all,

I'm building a multi-tier web application that is primarily driven by a web
service back end.

Are there any configuration settings I should know about to increase the
performance of the site?

For example, if the site is going to service 100+ users, do I need to do
anything special to ensure IIS can contact my back-end webservice at the
highest possible throughput?

The webservice will be hosted on the same machine as the website.

The webserivce primarily interacts with a SQL Server database. DTOs are
passed back and forth between the web service and the web front-end
(ASP.NET web application).

Any hints, tips, etc. would be greatly appreciated.

Thanks!
Oct 18 '07 #1
4 1887
Not really, but if the webservice and the website are both hosted on the same
box, why do you need a webservice? Why not just have your Data layer talk
directly to the database - that would certainly be the fastest.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Spam Catcher" wrote:
Hi all,

I'm building a multi-tier web application that is primarily driven by a web
service back end.

Are there any configuration settings I should know about to increase the
performance of the site?

For example, if the site is going to service 100+ users, do I need to do
anything special to ensure IIS can contact my back-end webservice at the
highest possible throughput?

The webservice will be hosted on the same machine as the website.

The webserivce primarily interacts with a SQL Server database. DTOs are
passed back and forth between the web service and the web front-end
(ASP.NET web application).

Any hints, tips, etc. would be greatly appreciated.

Thanks!
Oct 18 '07 #2
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
<pb*******@yahoo.yohohhoandabottleofrum.comwrote in
news:51**********************************@microsof t.com:
Not really, but if the webservice and the website are both hosted on
the same box, why do you need a webservice? Why not just have your
Data layer talk directly to the database - that would certainly be the
fastest.
Couple reasons:

1. I can move the front end to another server in the future for scalability

2. The backend web service can be used by other tools in the future :-)

In fact, we have a desktop administration tool which does site maintainance
through these the web service.

Oct 20 '07 #3
Peter Bromberg [C# MVP] wrote:
Not really, but if the webservice and the website are both hosted on the same
box, why do you need a webservice? Why not just have your Data layer talk
directly to the database - that would certainly be the fastest.
You'd think so but I've been thinking about this a bit myself recently.
If you're talking to your databases via something like nNibernate,
there's an initialization phase when setting up nHibernate where it
builds an map telling it how objects relate to database objects. This is
kind of a time consuming process and in a Windows Forms app you'd
usually only do this once, when the app was launching. In a Web app, as
with a windows app, you're going to have to do this, at the very least,
once each time the application domain gets loaded - however the app
domain can potentially get loaded a lot more often in Web Apps (and it's
not under your direct control when this happens)... and to achieve that
"just once" scenario in a web app you need to override the
Application_Start() event of the global.asax file and make sure you
store a thread safe reference to the object map in a static member that
is accessible to all the other threads in your web app (which doesn't
sound like it would be too hard).

Alternatively, you can have an NT Service application running a WCF
service or something, which takes care of all the DB work and
initializes that object map once and only once - when the operating
system boots and the service gets loaded. That WCF service is then
available to any threads in your web app (maybe via Named Pipes if it's
running on the same box, which has fairly minimal overhead aside from
the obvious serialization/deserialization) and which, as an added bonus,
can also be made available to other processes (potentially on remote
clients).

I'm not sure what kind of performance each of the above two
architectures would yield comparatively as I haven't tried them both yet
with the back end DB code and run any empirical analysis. However I'm
currently in the process of building a web app that needs to do a bunch
of stuff with databases which I've encapsulated in a MyAppService:
IMyAppService class (in a separate assembly). Initially I figured I'd
try the path of least resistance and simply add a direct reference to
that separate assembly to the web application project and instantiate
MyAppService directly in the code for the web app... if that's too slow
(which I suspect it will be) I figured I'd go the extra mile and yank
out all the stuff that initializes the object map for nHibernate and
make sure it gets called in the Application_Start() event of the
Global.asax file. If that still doesn't give the desired performance
then I'll try the second architecture - add some DataContract and
DataMember attributes to the IMyAppService interface and add some WCF
configuration sections into the config files of a separate NT Service
app (to host the MyAppService service) and the web application which
needs to consume this "service".

You can get better performance again with WCF services by using custom
binary serializers and the like, so if performance is really key and
you're using architecture number 2 then that's always on the cards as
well... although it involves writing more code and even though I'm a
programmer I'm always a bit loath to actually write code if I can avoid
it ;-)

Best Regards,

James Crosswell
Microforge.net LLC
http://www.microforge.net
Oct 21 '07 #4
James Crosswell <ja***@microforge.netwrote in news:OmJm5sDFIHA.4400
@TK2MSFTNGP04.phx.gbl:
If you're talking to your databases via something like nNibernate,
there's an initialization phase when setting up nHibernate where it
builds an map telling it how objects relate to database objects.
I use LLBLGen Pro ... It has no caching, so there is no object
initialization delay (besides the standard instantation delays).

If you get a chance, give LLBLGen Pro a try. It can run in 2 modes, self-
servicing and adapter.

Adapter is akin to Datasets (disconnected).

Self-Servicing can fetch data dynamically... perfect for easy access to
data as you need it (hence no map building).

Performance with the web service layer is definately slower than direct DB
calls ... but the flexability it provides I think is worth it (it basically
makes all code reusable and more importantly distributable for redundancy).
Oct 23 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ray5531 | last post by:
We have a solution consists of an O/R mapper project,Business Logice layer and a Web application.I need to add a windows service to this solution and add the business logic layer as a reference to...
25
by: Stuart Hilditch | last post by:
Hi all, I am hoping that someone with some experience developing nTier apps can give me some advice here. I am writing an nTier web app that began with a Data Access Layer (DAL), Business...
0
by: Al Fatykhov | last post by:
Using MABLE logic engine with existing .NET applications. MABLE web services provide an interface to MABLE business objects and logic. Let us review some technical details of the MABLE web...
0
by: Al Fatykhov | last post by:
Using MABLE logic engine with existing .NET applications. MABLE web services provide an interface to MABLE business objects and logic. Let us review some technical details of the MABLE web...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.