Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

120 lines (103 sloc) 3.732 kb
import scala.collection.JavaConversions._
import com.twitter.flockdb.config._
import com.twitter.gizzard.config._
import com.twitter.querulous.config._
import com.twitter.querulous.StatsCollector
import com.twitter.conversions.time._
import com.twitter.conversions.storage._
import com.twitter.flockdb.shards.QueryClass
import com.twitter.flockdb.Priority
import com.twitter.ostrich.admin.config.AdminServiceConfig
import com.twitter.logging.Level
import com.twitter.logging.config._
trait Credentials extends Connection {
val env = System.getenv().toMap
val username = env.get("DB_USERNAME").getOrElse("root")
val password = env.get("DB_PASSWORD").getOrElse("")
}
class ProductionQueryEvaluator extends AsyncQueryEvaluator {
override var workPoolSize = 40
database.memoize = true
database.pool = new ThrottledPoolingDatabase {
size = workPoolSize
openTimeout = 100.millis
}
query.timeouts = Map(
QueryClass.Select -> QueryTimeout(1.second),
QueryClass.Execute -> QueryTimeout(1.second),
QueryClass.SelectCopy -> QueryTimeout(15.seconds),
QueryClass.SelectModify -> QueryTimeout(3.seconds),
QueryClass.SelectSingle -> QueryTimeout(1.second),
QueryClass.SelectIntersection -> QueryTimeout(1.second),
QueryClass.SelectIntersectionSmall -> QueryTimeout(1.second),
QueryClass.SelectMetadata -> QueryTimeout(1.second)
)
}
class ProductionNameServerReplica(host: String) extends Mysql {
val connection = new Connection with Credentials {
val hostnames = Seq(host)
val database = "flockdb_development"
}
queryEvaluator = new QueryEvaluator {
database.memoize = true
database.pool = new ThrottledPoolingDatabase {
size = 1
openTimeout = 1.second
}
}
}
new FlockDB {
aggregateJobsPageSize = 500
mappingFunction = ByteSwapper
jobRelay = NoJobRelay
nameServerReplicas = Seq(new ProductionNameServerReplica("localhost"))
jobInjector.timeout = 100.millis
jobInjector.idleTimeout = 60.seconds
jobInjector.threadPool.minThreads = 30
val databaseConnection = new Credentials {
val hostnames = Seq("localhost")
val database = "edges_development"
urlOptions = Map("rewriteBatchedStatements" -> "true")
}
val edgesQueryEvaluator = new ProductionQueryEvaluator
val lowLatencyQueryEvaluator = edgesQueryEvaluator
val materializingQueryEvaluator = new ProductionQueryEvaluator {
workPoolSize = 1
database.pool = new ThrottledPoolingDatabase {
size = workPoolSize
openTimeout = 1.second
}
}
class DevelopmentScheduler(val name: String) extends Scheduler {
override val jobQueueName = name + "_jobs"
val schedulerType = new KestrelScheduler {
val queuePath = "."
}
errorLimit = 100
errorRetryDelay = 15.minutes
errorStrobeInterval = 1.second
perFlushItemLimit = 100
jitterRate = 0
}
val jobQueues = Map(
Priority.High.id -> new DevelopmentScheduler("edges") { threads = 32 },
Priority.Medium.id -> new DevelopmentScheduler("copy") { threads = 12; errorRetryDelay = 60.seconds },
Priority.Low.id -> new DevelopmentScheduler("edges_slow") { threads = 2 }
)
val adminConfig = new AdminServiceConfig {
httpPort = Some(9990)
}
loggers = List(new LoggerConfig {
level = Some(Level.INFO)
handlers = List(
new ThrottledHandlerConfig {
duration = 60.seconds
maxToDisplay = 10
handler = new FileHandlerConfig {
filename = "development.log"
roll = Policy.Hourly
}
}
)
})
}
Jump to Line
Something went wrong with that request. Please try again.