Answer the question
In order to leave comments, you need to log in
How to find out what loads ram and cpu on the asp mvc site?
Hello! There is a news site
with 3 thousand uniques, not so much, what you can only cache - [OutputCache(Duration = 180)]
like this - [OutputCache(Duration = 180, Location = System.Web.UI.OutputCacheLocation.ServerAndClient)] - it doesn't work, you can't write to child elements.
Memory consumption has already exceeded 1 GB. CPU 50% The other day the database began to hang.
I figured out that the database hung when receiving a record when trying to increase the view ( recordDB.Views = Views + tmp;
db.SaveChanges();)
//УВЕЛИЧИМ ПРОСМОТР ЕСЛИ ИСТИНА
if (db == null) { db = new Times_DLL.Model.TimesDBEntities(); }
if (ViewPlus == true)
{
Random rand = new Random();
var recordDB = (from o in db.Records where o.id == id_record select o).FirstOrDefault();
int? Views = recordDB.Views ?? 0;
int tmp = rand.Next(2, 4);
recordDB.Views = Views + tmp;
db.SaveChanges();
ViewPlus = false;
var recordDB2 = (from o in db.Records where o.id == id_record select o).FirstOrDefault();
int? ff = recordDB2.Views ?? 0;
}
//возвращаем 1 дб объект
var record = (from rec in db.Records
join usr in db.UserProfiles on rec.User_id equals usr.id
join typ in db.TypesRecord on rec.Type equals typ.id
join cat in db.CategoriesRecord on rec.Category equals cat.id
join seo_source in db.SEOs on rec.id equals seo_source.id_record
into t1
from seo in t1.DefaultIfEmpty()
where rec.id == id_record && rec.Deleted == false
select new { record = rec, user = usr, TypeName = typ, PathImgCategory = cat, seo = seo }).AsEnumerable();
return record.Select(o => MapToRecordsBLLseo(o.record, o.user, o.TypeName, o.PathImgCategory, o.seo)).SingleOrDefault();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question