.net - Linq to SQL Performance -
succinct
how performance tune linq sql dal methods? amount of data being transferred.
verbose
i have winform app uses linq sql access it's data. have 5 branches, 1 physically @ same location sql server , other 4 @ various distances , bandwidths. app typical enterprise lob crud app. search person, select them, , select control, demographics, loads person's demographics , displays them on screen.
i store "key stone" id's , make db calls using primary keys. works great in main location, sql server on site. however, branches experiencing severe delay loading of controls.
this typical example(loading person details user control) of dal:
public static datatable getgeneralpersoninfo(int personid) { using (var context = connectdatacontext.create()) { var generalpersoninfo = person in context.tblpersons person.personid == personid join addresse in context.tbladdresses.where(a =>a.addresstypeid == 'm') on person.personid equals addresse.personid select new { person.personid, person.firstname, person.middlename, person.lastname, person.suffixid, person.titleid, addresse.addressline1, addresse.addressline2, addresse.addressline3, addresse.cityname, addresse.stateid, addresse.zipcode, addresse.zipplus, addresse.directionstoaddress, addresse.countyid, person.residencycountyid, person.responsibilitycountyid, person.emailaddress, person.ssn, person.gender, person.birthdate, person.deathdate, person.driverslicensenumber, person.driverslicensestateid, person.hispanicoriginflag, person.citizenflag, person.veteranflag, person.maritalstatusid, person.primaryraceid, person.secondaryraceid, person.updateuserid, person.updatedatetime, person.insertdatetime, person.insertuserid, }; return generalpersoninfo.copylinqtodatatable(); } }
anything glaringly wrong there?
provide further disclosure, every table has uniqueidentifier
not pk
. also, have wide tables(60+ columns someplaces) large text fields(varchar(500 - max)).
i store "key stone" id's , make db calls using primary keys
this problem.
assume load entities 100 keys.
local branch, 1ms latency. 100ms network. 0.1 seconds - performance "ok".
remote branch, let's 60ms latency. 6000ms network. 6 seconds. , itonly goes down there.
old rule, teached me 15 years ago: not write chatty interfaces tier boundaries. make few calls possible. made interface many calöls possible.
the rest caching (lare fields - how change?).
Comments
Post a Comment