Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

If I search for the tag I see 344,380 questions tagged, but if I click on a question it says there are 344,401 question with the Java tag. I can understand the information being slightly out of date but it appears it is also inconsistent. If I run the search again, I see the first result still. Over time they both update but appear to be slightly off.

share|improve this question
I'm not saying it was caching, but was totally caching. – Charles Dec 28 '12 at 20:08
Totally cached twice. ;) – Peter Lawrey Dec 28 '12 at 20:09
Meta law No 1: It's always Ka-ching. – Daniel Fischer Dec 28 '12 at 21:54
hmm. Seems to be a bug – syed mohsin Dec 28 '12 at 23:08
And those extra (or missing) 21 questions matter why? – Chris Gerken Dec 30 '12 at 1:57
up vote 2 down vote accepted

The value for counts is cached for quite a while, the expense of making that 100% accurate all the time is sooooo not worth it.

share|improve this answer
If it is effort you want to minimise I would have though one inaccurate count is better than two. ;) – Peter Lawrey Dec 29 '12 at 11:06
@PeterLawrey - one count comes from the tag engine, which is a request made on the list page to another box from the web tier...the other count comes from the database as part of a call loading the question, so in each case it's a more-local access that's cheaper. It's not effort but performance we're concerned with here...if we can code and make it better without making a question page load slower, we'll do it every time. – Nick Craver Dec 29 '12 at 11:08
I would have thought you have a Map of Tag to count on each web server which is updated periodically from the back end. When you get the results of a search count for one tag, that could count as an update. ;) – Peter Lawrey Dec 29 '12 at 11:14
@PeterLawrey - that'd be doing the same work (for millions of tags) for n web servers...that's not very efficient at scale, since they're all duplicating the database load to get that count, or we're repeating it and echoing the same cache issue you see. – Nick Craver Dec 29 '12 at 11:15
Ok, That makes sense. So I assume there is no layer between the web servers and the database. If there were it could cache results centrally, reduce duplication of effort and distribute query results to the web servers. – Peter Lawrey Dec 30 '12 at 10:55
@PeterLawrey - there are many facets to our caching, there's a cache on the web tier, in redis, (sometimes) in the tag engine, in elastic, then the DB or other datasource itself. Don't make assumptions...when you're serving billions of requests a month caching gets complicated :) And of course there are tradeoffs to everything at every level. Even in the case you just described, that's another call to another cache we don't make currently, so it adds expense and page load time (don't forget maintaining that cache as well, there's extra time there). – Nick Craver Dec 30 '12 at 10:58
My back ground is in the distribution of financial data where latencies are typically in the 1 milli-second range and you are looking to distribute tens of thousands of updates per second using a publisher of updates model. The updates are smaller but I would have thought it would be useful all the same. I am sure there are complexities which escape me, but the numbers don't seem that high. – Peter Lawrey Dec 30 '12 at 11:17
@PeterLawrey - I never said it wasn't doable...I said it's not worth it. The publisher you're talking about doesn't exist. That model also ignores that you have to build both a push and pull model since we build often and it'd blow away the local cache the publisher would be updating. Having a central store of that value is a better option for us for lots of reasons that don't fit in a comment stream. – Nick Craver Dec 30 '12 at 12:04
I guess my reaction comes from the fact I spend most of my time these days spotting inconsistencies in data values. (The last three days actually ;) I am sure it's not important to most people and should only be used as a guide number. I was just curious as to the cause. :) – Peter Lawrey Dec 30 '12 at 12:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .