Marco Cecconi
Twitter: @sklivvz Blog: http://sklivvz.com
Architecture:
Performance:
build
measure
analyze
build
measure
analyze
Build
Measure
Analyze
https://stackexchange.com/performance
build
measure
analyze
public static List<HelpPost> All()
{
return Current
.GlobalCache
.GetSet<List<HelpPost>>(
CacheKey,
(old, ctx) =>
{
using (SitesDBContext sitesDb = SitesDBContext.NewContext())
{
return sitesDb.Query<HelpPost>(@"
SELECT p.Id, p.Title, p.Body, p.DeletionDate, p.SiteId,
p.SitePostId, p.IsModEditable, p.ParentHelpPostId,
p.CreationDate, p.PinnedDate, p.LastEditDate, p.Slug,
p.HelpPostTypeId, p.Subtitle, p.LCID,
c.Id AS CategoryId, c.Rank AS CategoryRank
FROM
HelpPosts p LEFT JOIN
HelpCategories c
ON p.HelpCategoryId = c.Id
WHERE DeletionDate IS NULL");
}
}, 24 * 60 * 60, 24 * 60 * 60, server: StackRedis.Server.PreferSlave);
}
Build
Measure
Analyze
public static List<HelpPost> All()
{
return Current
.GlobalCache
.GetSet<List<HelpPost>>(
CacheKey,
(old, ctx) =>
{
using (SitesDBContext sitesDb = SitesDBContext.NewContext())
{
return sitesDb.Query<HelpPost>(@"
SELECT p.Id, p.Title, p.Body, p.DeletionDate, p.SiteId,
p.SitePostId, p.IsModEditable, p.ParentHelpPostId,
p.CreationDate, p.PinnedDate, p.LastEditDate, p.Slug,
p.HelpPostTypeId, p.Subtitle, p.LCID,
c.Id AS CategoryId, c.Rank AS CategoryRank
FROM
HelpPosts p LEFT JOIN
HelpCategories c
ON p.HelpCategoryId = c.Id
WHERE DeletionDate IS NULL");
}
}, 24 * 60 * 60, 24 * 60 * 60, server: StackRedis.Server.PreferSlave);
}
@Html.Partial("~/Views/Shared/PageTabs.cshtml", new StackOverflow.Views.Shared.PageTabs
{
Tabs = Current.LocalCache.GetSet<List<TabItem>>("question-show-tabs",
(_1,_2) => new List<TabItem>
{
new TabItem
{
Value = ShowViewData.Tab.Active,
Title = _s("active"),
Description = _s("Answers with the latest activity first"),
KeyboardShortcut = "A"
},
new TabItem
{
Value = ShowViewData.Tab.Oldest,
Title = _s("oldest"),
Description = _s("Answers in the order they were provided"),
KeyboardShortcut = "O"
},
new TabItem
{
Value = ShowViewData.Tab.Votes,
Title = _s("votes"),
Description = _s("Answers with the highest score first"),
KeyboardShortcut="V"
},
}, 24 * 60 * 60, 24 * 60 * 60),
UrlFormat = Question.UrlRelative + "?answertab={0}#tab-top",
CurrentSelection = Model.CurrentTab
})
@Html.Partial("~/Views/Shared/PageTabs.cshtml", new StackOverflow.Views.Shared.PageTabs
{
Tabs = Current.LocalCache.GetSet<List<TabItem>>("question-show-tabs",
(_1,_2) => new List<TabItem>
{
new TabItem
{
Value = ShowViewData.Tab.Active,
Title = _s("active"),
Description = _s("Answers with the latest activity first"),
KeyboardShortcut = "A"
},
new TabItem
{
Value = ShowViewData.Tab.Oldest,
Title = _s("oldest"),
Description = _s("Answers in the order they were provided"),
KeyboardShortcut = "O"
},
new TabItem
{
Value = ShowViewData.Tab.Votes,
Title = _s("votes"),
Description = _s("Answers with the highest score first"),
KeyboardShortcut="V"
},
}, 24 * 60 * 60, 24 * 60 * 60),
UrlFormat = Question.UrlRelative + "?answertab={0}#tab-top",
CurrentSelection = Model.CurrentTab
})
<p>
@_s("Privileges control what you can do on $ShortName$. " +
"Gain more privileges by increasing your reputation " +
"(points you receive from your fellow users for posting" +
" helpful questions and answers).", Current.Site)
</p>
var repository = container.Resolve<IRepository<Order>>();
Order order = repository.Get(25);
public IRepository<T> Resolve<T>()
{
var data = new NHibernateRepository<T>();
var cache = new CachingRepository<T>(data);
var log = new LoggingRepository<T>(cache);
var sec = new SecurityRepository<T>(log);
var valid = new ValidatingRepository<T>(sec);
return valid;
}
build
measure
analyze
Build
Measure
Analyze
build
measure
analyze
people
tools
code
Build
Measure
Analyze