Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy didn't see 10 records in database?
    primarykey
    data
    text
    <p>I use JMeter to test my web application. and my test case is to add a record in database. and then I set the "number of thread user" to 20, it means that it will simulate 20 users work at the same time. and then I run the test case. But finally i found the system didn't create 20 records in database, but instead just create 13 records in database.</p> <p>I want to know why this happened ? Is it possible that because in my web application i didn't add a "synchronized" in front of the add records method ? I used linq, If two user post a request to create a record to server at the same time, what will happen? Just create a record or can successfully create two records, or unknown ?</p> <p>Following is the sample code for create a record in database:</p> <pre><code> public int SaveEventGroup(int id, Models.Entities.EventGroup e, Nullable&lt;int&gt; setpublish) { try { Entities.EventGroup db; if (id == 0) { db = new Entities.EventGroup(); db.CreatedBy = e.CreatedBy; db.CreateDatetime = DateTime.Now; db.Status = true; } else { db = this.GetEventGroup(id); } db.NameCN = e.NameCN; db.NameEN = e.NameEN; db.NameZH = e.NameZH; db.NamePT = e.NamePT; db.DisplayOrder = GetGroupMaxDisplayOrder() + 1; if (setpublish == null) { db.PublishStatus = false; db.PublishDatetime = null; db.UpdateDatetime = DateTime.Now; db.UpdatedBy = e.UpdatedBy; } if (id == 0) dataContext.AddToEventGroupSet(db); dataContext.SaveChanges(); return db.Id; } catch (Exception ex) { log.Error(ex.Message, ex); throw ex; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload