guide
  • Introduction
  • Guiding Principles
    • Mission Statement
    • Conflict Resolution Process
  • Operating Model
    • Working Together
    • Holacracy
      • Meetings
      • Specific Roles
      • Terms and Definitions
      • Finer Points
      • Holacracy-Asana Key
    • Getting Things Done
      • Daily, Weekly, Monthly, and Annual Reviews
      • GTD-Asana Key
    • Transparency
    • Language
    • Budgeting
    • By Department
      • Engineering Operations
  • General Guidelines
  • Employment Policies
    • Equal Opportunity Employment
    • At-Will Employment
    • Code of Conduct in the Community
    • Complaint Policy
    • Drug and Alcohol Policy
    • Vacation, Holiday, and Paid Time Off (PTO) Policy
    • Supplemental Policies for Remote Employees and Contractors
    • Supplemental Policy for Bonus, Commissions, and other Performance-based Payments
    • Supplemental Policies for Hourly International Contractors or Workers
    • Supplemental Policies for Hourly International Contractors or Workers
    • Disputes and Arbitration
  • Benefits and Perks
    • Health Care
    • Vacation, Holiday and Paid Time Off (PTO) Policy
    • Holiday List
  • Hiring Documents
    • Acknowledgement of Receipt
    • Partner Proprietary Information and Inventions Agreement
  • Engineering Wiki
    • Code Snippets
      • Front End Code Snippets
    • Setup
      • 1: Overview of development using Audienti
      • 2: How to setup your dev environment on Docker
      • 2a: Setting up on our cloud your dev server
      • 3: Connect to Production using the VPN
      • 4: Import data into your development environment
    • Deployment
      • Docker based deployment of back end (manual)
    • Culture
      • How our development team works
      • Code Best Practices
    • Tips
      • Setting up a new development machine
      • Importing data to Development environment
      • GIT workflow and work tracking
      • Using Slack
      • Using Rubocop
      • Our Code Standards
      • General suggested best practices
      • Tracking your time
      • Naming Iterations
    • Migrations
      • Postgres
      • ElasticSearch
      • Redis
    • Database and System Maintenance
      • Redis Howtos
      • Elasticsearch HowTos
      • Postgres HowTos
      • Administration recipes
      • App maintenance crash course notes
    • Front End
      • 2016 Plan
      • Deploy
      • Assets
      • SearchLogic
      • How to create UI components
      • OMA Standard Tables
    • Monitoring and Alerting
      • Monitoring Systems
      • Monitoring individual controller actions
      • Get notified when a metric reaches a certain threshold
      • Instrumenting your models using Oma Stats
      • Configuring Graphite Charts
      • Tracking your results with StatsD
      • Logging Fields
      • Updating Kibana Filtering
    • Testing
      • Coverage
      • Elasticsearch mapping config synchronization
      • Testing Gotchas
      • Rspec Preloader
      • Test Best Practices
    • Models
      • Backlinks
    • Queueing and Worker System
      • Queueing and Job Overview
    • Processors
      • Rebuilding Spot Instances
      • Deploying processors
      • Running processors in development
      • Reverting to the previous build on a failed deployment
    • Processors / Opportunity Pipeline
      • Opportunity Pipeline
      • Diagram
    • Processors / Enrichment Pipeline
      • Diagram
      • Clustering
    • Processors / Backlink Pipeline
      • Diagram
      • Backlink Pipeline external APIs
      • Backlink pipeline logic
    • Processors / Automation Pipeline
      • Diagram
      • Automation Pipeline Overview
      • Agents
      • Running in development
    • Messaging and Social Accounts
      • Overview
    • API
      • Audienti API
    • Algorithms
    • Troubleshooting
      • Elasticsearch
    • Big Data Pipeline Stuff
      • Spark
    • Our Product
      • Feature synopsis of our product
    • Research
      • Backend framework comparison
      • Internet marketing Saas companies
    • Code snippets
      • Commonly Used
      • Not Used
    • Miscellaneous
      • Proxies and Bax
    • Legacy & Deprecated
      • Search criteria component
      • Classes list
      • Target Timeline
      • Twitter processor
      • Asset compilation
      • Test related information
      • Interface to EMR Hadoop jobs
      • Mongo Dex Indexes to be Built
      • Mongodb errors
      • Opportunity pipeline scoring
      • Graph Page
      • Lead scoring
      • Insights
      • Shard keys
      • Setting up OMA on local
      • Clone project to local machine
      • Getting around our servers in AWS
  • Acknowledgements
  • Documents That Receiving Your First Payment Triggers Acknowledgement and Acceptanace
Powered by GitBook
On this page
  • Slow queries due to lack of indices
  • TypeError: No c decoder
  • "Execution expiration" and "Connection closed" caused by mongoid counts.
  1. Engineering Wiki
  2. Legacy & Deprecated

Mongodb errors

PreviousMongo Dex Indexes to be BuiltNextOpportunity pipeline scoring

Last updated 7 years ago

(by nicholas, last updated: mar 2013)

There are three distinct problems we have with mongodb.

  1. "Execution expiration" and "Connection closed" caused by mongoid counts.

  2. "TypeError: No c decoder"

  3. Slow queries due to lack of indices

Back in december the application was unusable due to 3 and 1 occurring simultaneously. Back then we migrated off of MongoHQ to be able to see attach monitoring systems to it and dig deeper into what may cause these slowdowns.

Slow queries due to lack of indices

When we migrated we were able to run "dex", a log analyzer that recommends indices. We added a set of indices to the database and the application became usable, however there were other problems. It's important to note though that we have added a lot of indices and although we still have slow queries, the slowest one we've recorded is 6 seconds. nothing close to 30seconds that cause timeouts.

current status: resolved to adequate standards, optimizing these 6s queries is not the most important thing right now. We'll defer that.

TypeError: No c decoder

"TypeError: No c decoder" started occurring and is currently not addressed, they occur on mentions which are inherently temporal data and my belief is that this is a data consistency issue (aka, we are writing crap into it and we fail to get this crap back out).

current status: unresolved but temporal, solving this requires some more research.

"Execution expiration" and "Connection closed" caused by mongoid counts.

Which brings me to the reason I wrote this page. After the indices were added I investigated the mongo database statistics using tools like mms.10gen.com and the mongo shell. Our db statistics have some interesting figures and while some numbers are large they appear to be normal according to mongodb documentation. Except for this one:

According to mongodb documentation this is caused by the application requesting that. So what happens is that our application is downloading a large amount of data (using a cursor, which is the same thing as an iterator). code like

@pages.each do
end

Basically our database becomes big and stuff like

@pages.count
@pages.blank?
@pages.empty?

become really slow because they are using that count-operation.

This is what we have to remove from our application, unfortunately it's hard to know when mongoid is using this operation so we have to rely on exceptional errors pointing us to it.

So the other issue we are running in is this

https://gist.github.com/noverloop/d503b2dd39c10fd791b1#file-gistfile1-txt-L152
http://stackoverflow.com/questions/9778420/mongo-count-really-slow-when-there-are-millions-of-records