You may want to experiment with setting the buffer size property for
the AdoNetAppender:

 <bufferSize value="50" />

so that messages are written to the database in batches of 50 records
instead of after every message. 

The FastDbAppender bypasses much of the log4net framework and interacts
directly with a SqlCommand object to write values to the database:

http://tinyurl.com/7unou
http://cvs.apache.org/viewcvs.cgi/logging-log4net/examples/net/1.0/Appenders/SampleAppendersApp/cs/src/Appender/

That same directory has code for an async FileAppender that writes the
messages on a different thread. I believe NLog's Database target
supports aysnc operations too.

--- Shawn Smiley <[EMAIL PROTECTED]> wrote:

> Thanks Giles and Larry,
> 
> Implementing the [TestFixtureSetup] helped a bit.
> 
> However, and I feel really stupid for not noticing
> this, the cause of the problem was that I had log4net
> setup to log to the database and set to log everything
> (including debug info for log4net and ibatis).  Thus
> it was doing a rediculous number of writes to the
> database for every request.
> 
> I disabled the log4net and ibatis debugging and
> reduced the logging level to WARN and now everything
> works in under a second.
> 
> 
> Thanks again for all of your help and please accept my
> appologies for not noticing (or even mentioning) that
> the logging could be the cause of the problem.
> 
> -Shawn.
> 
> --- Gilles Bayon <[EMAIL PROTECTED]> wrote:
> 
> > Use a [TestFixtureSetUp] method on your test where
> > you init the sqlMap and a 
> > [SetUp] method where you re-init your database, see
> > the current
> > BaseTest.csunit file in SVN.
> > You could also use the version in SVN, which remove
> > the usage of 
> > XmlSerialization for init ans speed up the loading
> > of config file.
> >  On 8/16/05, Shawn Smiley <[EMAIL PROTECTED]>
> > wrote: 
> > > 
> > > Slight clarification on my previous message.
> > > 
> > > I see the 8-10 second wait each time the NUnit
> > test is
> > > run. However if I create another test with a loop
> > in
> > > it, the loop executes 10 times in about 9 seconds
> > on
> > > average.
> > > 
> > > So I guess a better question would be how to
> > reduce
> > > the initial time that it takes to get back a
> > result
> > > set?
> > > 
> > > Thanks.
> > > 
> > > 
> > > --- Shawn Smiley <[EMAIL PROTECTED]> wrote:
> > > 
> > > > This happens consistently. I've run the test 15
> > > > times
> > > > in a row with the response time varying between
> > 8
> > > > and
> > > > 10 seconds each time.
> > > >
> > > > My call into iBatis is from a static method that
> > has
> > > > only the following two lines it it:
> > > > IList Results =
> > > >
> > _Mapper.QueryForList("SelectVisitTeamsByVisit_New",
> > > > visitId);
> > > > return Results;
> > > >
> > > >
> > > > Here are the entries in my xml files.
> > > >
> > > > <resultMap id="VisitTeamUserMap"
> > > > class="VisitTeamUser">
> > > > <result property="ArtifactDirectory"
> > > > column="ArtifactDirectory" />
> > > > <result property="TeamIconCollectionName"
> > > > column="IconCollectionName" />
> > > > <result property="TeamId" column="TeamID" />
> > > > <result property="TeamName" column="TeamName" />
> > > > <result property="Version" column="Version" />
> > > > <result property="VisitId" column="VisitID" />
> > > > <result property="Active" column="UserActive" />
> > > > <result property="Deleted" column="Deleted" />
> > > > <result property="Email" column="Email" />
> > > > <result property="EncryptedPassword"
> > > > column="Password"
> > > > />
> > > > <result property="FirstName" column="FirstName"
> > />
> > > > <result property="Grade" column="Grade" />
> > > > <result property="LastName" column="LastName" />
> > > > <result property="MustChangePassword"
> > > > column="MustChangePassword" />
> > > > <result property="PhoneNumber"
> > column="PhoneNumber"
> > > > />
> > > >
> > > > <result property="Title" column="Title" />
> > > > <result property="UserId" column="UserID" />
> > > > <result property="Username" column="Username" />
> > > > <result property="DefaultPassword"
> > > > column="DefaultPassword" />
> > > > <result property="UserTeamId" column="TeamID" />
> > > > <result property="UsernameNumber"
> > > > column="UsernameNumber" />
> > > > <result property="UserVersion"
> > column="UserVersion"
> > > > />
> > > > </resultMap>
> > > >
> > > > <select id="SelectVisitTeamsByVisit_New"
> > > > parameterClass="int"
> > resultMap="VisitTeamUserMap">
> > > > SELECT T.TeamName, T.IconCollectionName,
> > T.Active,
> > > > VT.TeamID, VT.VisitID,
> > > > VT.ArtifactDirectory, VT.Version, UA.UserID,
> > > > UA.OrganizationID, UA.SupervisorUserID,
> > > > UA.PrivacyLevel, UA.Gender, UA.UserType,
> > > > UA.WorkspaceStatus, UA.Username,
> > > > UA.Password, UA.FirstName, UA.LastName,
> > UA.Email,
> > > > UA.PhoneNumber, UA.Active AS UserActive,
> > > > UA.MustChangePassword, UA.Title, UA.Deleted,
> > > > UA.Grade,
> > > > UA.DefaultPassword,
> > > > UA.UsernameNumber, UA.Version AS UserVersion
> > > > FROM Teams T
> > > > LEFT OUTER JOIN VisitTeams VT ON
> > > > T.TeamName=VT.TeamName AND VisitID=#value#
> > > > INNER JOIN UserAccounts UA ON
> > VT.TeamID=UA.TeamID
> > > > ORDER BY T.TeamName
> > > > </select>
> > > >
> > > >
> > > >
> > > > Thanks again.
> > > >
> > > >
> > > >
> > > > --- Larry Meadors <[EMAIL PROTECTED]>
> > wrote:
> > > >
> > > > > No, that is not at all normal.
> > > > >
> > > > > Are you seeing that consistently, or only on
> > the
> > > > > first load?
> > > > >
> > > > > Larry
> > > > >
> > > > >
> > > > > On 8/16/05, Shawn Smiley
> > <[EMAIL PROTECTED]>
> > > > > wrote:
> > > > > > I'm using iBatis on my first project and
> > love
> > > > the
> > > > > > separation of the data access from my code.
> > > > > >
> > > > > > However after implementing a few pages of my
> > > > > > application using it, I'm noticing a
> > significant
> > > > > > performance cost to using iBatis.
> > > > > >
> > > > > > For example, I have a simple query that
> > returns
> > > > 48
> > > > > > rows of 40 fields each. The query itself
> > > > returns
> > > > > in a
> > > > > > fraction of a second in the SQL Query
> > Analyzer,
> > > > > > however the unit test calling through iBatis
> > > > takes
> > > > > > 8-10 seconds to return the 48 objects.
> > > > > >
> > > > > > My result map does not do any selects or
> > fancy
> > > > > data
> > > > > > conversions. The query results map directly
> > to
> > > > > > properties in the data class using all
> > primative
> > > > > data
> > > > > > types (strings, ints, bools).
> > > > > >
> > > > > > Is this performance hit normal and is there
> > > > > anything I
> > > > > > can do to improve it?
> > > > > >
> > > > > >
> > > > > > Thanks,
> > > > > > Shawn.
> > > > > >
> 
=== message truncated ===

Reply via email to