Link to home
Start Free TrialLog in
Avatar of Kalleman
Kalleman

asked on

Performance issues with object remoting (MS.NET)

We are in the process of developing an enterprise project management system using MS.NET (C#).

The internal structure of the system is based on object remoting, which provides a whole lot of great features, but also seems to carry with it a few intricate problems.

The problem is basically that when we access properties and methods of remoted objects, the bad performance forces us to use "ugly" solutions. Let me illustrate this with an example:

Let's assume that "PersonArray" holds 1000 remoted objects of the class "Person". Executing the following code then takes ages!

  foreach(Person CurrentPerson in PersonArrray)
  {
    CurrentPerson.Age++;
  }

If the corresponding code is executed on the server side, the code takes virually no time at all to execute. We have only found one solution that manages to speed the operation up, at least a bit, and that is to send the array to the server side and execute the loop there.

So, the problem is basically that looping over large collections of remoted objects takes ages.

Does anyone know how we can solve the problem? Any tips where we can find in-depth reading about object remoting?



Best regards
Karl Hagstrom
Bite Solutions AB
Sweden
Avatar of snoegler
snoegler

Hmm this is a typical task which should be DONE at server side. Imagine a SQL database:

UPDATE customers SET customer_id=customer_id+1

If the DB would act like your example, the client of the SQL Server would fetch all records (completely, like SELECT *), increase the field customer_id by one, and send each record back to the server. Now this would take ages :)

You should modify your design, handle processes like this completely on the server and provide a straight, orthogonal interface.
Avatar of Kalleman

ASKER

OK. I must say that I agree. Making trillions of calls to the server side, instead of making one bach call IS bad. However, my goal is to use an architecture that doesn't force me to implement trillions of methods on the server side like:

UpdatePhoneNumbersForPersons(...)
ChangeOwnerOfCar(...)
RemoveEmployeesFromCompany(...)
...
...

Being able to handle my objects directly on the client side isolates the client from the server and makes the code structure better. I have been trying (without satisfactory results) to implement a solution with disconnected objects, sort of a "check out" of business objects to talk in source code control terms.
ASKER CERTIFIED SOLUTION
Avatar of snoegler
snoegler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A sneaky possibility is to build a stored procedure dynamically, post it to the server, execute it, then delete it.  This has the advantage of flexibility, but requires that the user's workstation have that level of access to the db server.  Update queries don't have result sets, so there's no debris.
Avatar of DanRollins
I think you should just code the PersonArray remote object with functions that iterate across all of its Person objects, or a specified subset of them:

    PersonArray.UpdateAll( AGE, +1 );

    PersonArray.Update( AGE, +1, "lastname > 'S'" );

The idea being that the Person object never gets moved across the network.

-- Dan
Thanks for the feedbak, even if it means I probably have to completely redesign the data tier of our system. *doh*