This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I have to insert some data (something like 100-150 records per second) in a local MySQL database. No selects, no updates, just inserts; the database will be queried "offline" at a later time. The only selects I have to do are for connecting the new data to those already stored (essentially I check if the data exist and use them if they do, insert them if they don't), and I'm caching the data so I don't have to hit the db multiple times for every insert. Once the data are cached, the process is fast enough, but it deteriorates with time: it goes slower and slower. By benchmarking the system, I see that a large part of the time is spent inside Lightspeed, in a method called ValidateEntity in TypeModel.cs. Going up the call tree, I see that the call to PerformUnload in ObjectUnloader.cs counts for 60% of the time. Is there anything I can do to speed things up? Is there a way to disable entity validation? Is that even the problem? The CPU never seems to hit 100%, so I'm not sure what the real issue could be. Is there anything I could do to pinpoint this issue better? Thanks in advance. |
|
|
Entities are validated prior to being persisted so if you are seeing a lot of validation calls it will be because the entities which are being persisted most likely have associations where the attached network graph spans a large amount of the objects already in memory so they all get walked to check that they in turn are valid. You can disable the validation checking across associations either at a per association level or for an entire type. To disable it on a specific association apply a [ValidationNoTraverse] attribute to the association property, or for an entire type apply a [ValidationIgnoresAssociations] attribute to the class.
|
|
|
I can't seem to be able to find those two attributes. In which namespace should they be located? Were they introduced recently? I'm using Lightspeed version 4.0.859.18600. One more thing: when I find them, I should be able to add them to an entity or association using the Custom Attributes property in the designer, right? Thanks again. |
|
|
Yep, they have were added about 2 months ago so make sure you are using a recent nightly build for this. And yes, you should add these via the CustomAttributes property in the designer :)
|
|