🐝
Mess around software system design
  • README
  • ArchitectureTradeOffAnalysis
    • Estimation
    • Middleware
    • Network
    • Server
    • Storage
  • Conversion cheat sheet
  • Scenarios
    • TinyURL
      • Estimation
      • Flowchart
      • Shortening mechanisms
      • Rest API
      • Performance
      • Storage
      • Follow-up
    • TaskScheduler
      • JDK delay queue
      • Timer based
      • RabbitMQ based
      • Kafka-based fixed delay time
      • Redis-based customized delay time
      • MySQL-based customized delay time
      • Timer TimingWheel
      • Industrial Scheduler
      • Workflow Engine
      • Airflow Arch
    • GoogleDrive
      • Estimation
      • Flowchart
      • Storage
      • Follow-up
    • Youtube
      • Estimation
      • Flowchart
      • Performance
      • Storage
      • Follow-up
      • Netflix
    • Uber
      • Estimation
      • Rest api
      • Flowchart
      • KNN algorithms
      • Geohash-based KNN mechanism
      • Redis implementation
      • Storage
    • Twitter
      • Estimation
      • Flowchart
      • Storage
      • Scalability
      • Follow-up
    • Instant messenger
      • Architecture overview
      • Presence
      • Unread count
      • Notifications
      • Read receipt
      • Large group chat
      • Storage-Offline 1:1 Chat
      • Storage-Offline group chat
      • Storage-Message roaming
      • NonFunc-Realtime
      • NonFunc-Reliability
      • NonFunc-Ordering
      • NonFunc-Security
      • Livecast-LinkedIn
    • Distributed Lock
      • Single machine
      • AP model based
      • CP model based
      • Chubby-TODO
    • Payment system
      • Resilience
      • Consistency
      • Flash sale
    • Key value store
      • Master-slave KV
      • Peer-to-peer KV
      • Distributed cache
  • Time series scenarios
    • Observability
      • TimeSeries data
      • Distributed traces
      • Logs
      • Metrics
      • NonFunc requirments
  • Search engine
    • Typeahead
    • Search engine
    • Distributed crawler
      • Estimation
      • Flowchart
      • Efficiency
      • Robustness
      • Performance
      • Storage
      • Standalone implementation
      • Python Scrapy framework
    • Stream search
  • Big data
    • GFS/HDFS
      • Data flow
      • High availability
      • Consistency
    • Map reduce
    • Big table/Hbase
    • Haystack
    • TopK
    • Stateful stream
    • Lambda architecture
    • storm架构
    • Beam架构
    • Comparing stream frameworks
    • Instagram-[TODO]
  • MicroSvcs
    • Service Registry
      • Flowchart
      • Data model
      • High availability
      • Comparison
      • Implementation
    • Service governance
      • Load balancing
      • Circuit breaker
      • Bulkhead
      • Downgrade
      • Timeout
      • API gateway
      • RateLimiter
        • Config
        • Algorithm comparison
        • Sliding window
        • Industrial impl
    • MicroSvcs_ConfigCenter-[TODO]
    • MicroSvcs_Security
      • Authentication
      • Authorization
      • Privacy
  • Cache
    • Typical topics
      • Expiration algorithm
      • Access patterns
      • Cache penetration
      • Big key
      • Hot key
      • Distributed lock
      • Data consistency
      • High availability
    • Cache_Redis
      • Data structure
      • ACID
      • Performance
      • Availability
      • Cluster
      • Applications
    • Cache_Memcached
  • Message queue
    • Overview
    • Kafka
      • Ordering
      • At least once
      • Message backlog
      • Consumer idempotency
      • High performance
      • Internal leader election
    • MySQL-based msg queue
    • Other msg queues
      • ActiveMQ-TODO
      • RabbitMQ-TODO
      • RocketMQ-TODO
      • Comparison between MQ
  • Traditional DB
    • Index data structure
    • Index categories
    • Lock
    • MVCC
    • Redo & Undo logs
    • Binlog
    • Schema design
    • DB optimization
    • Distributed transactions
    • High availability
    • Scalability
    • DB migration
    • Partition
    • Sharding
      • Sharding strategies
      • Sharding ID generator overview
        • Auto-increment key
        • UUID
        • Snowflake
        • Implement example
      • Cross-shard pagination queries
      • Non-shard key queries
      • Capacity planning
  • Non-Traditional DB
    • NoSQL overview
    • Rum guess
    • Data structure
    • MySQL based key value
    • KeyValueStore
    • ObjectStore
    • ElasticSearch
    • TableStore-[TODO]
    • Time series DB
    • DistributedAcidDatabase-[TODO]
  • Java basics
    • IO
    • Exception handling
  • Java concurrency
    • Overview
      • Synchronized
      • Reentrant lock
      • Concurrent collections
      • CAS
      • Others
    • Codes
      • ThreadLocal
      • ThreadPool
      • ThreadLifeCycle
      • SingletonPattern
      • Future
      • BlockingQueue
      • Counter
      • ConcurrentHashmap
      • DelayedQueue
  • Java JVM
    • Overview
    • Dynamic proxy
    • Class loading
    • Garbage collection
    • Visibility
  • Server
    • Nginx-[TODO]
  • Distributed system theories
    • Elementary school with CAP
    • Consistency
      • Eventual with Gossip
      • Strong with Raft
      • Tunable with Quorum
      • Fault tolerant with BFT-TODO
      • AutoMerge with CRDT
    • Time in distributed system
      • Logical time
      • Physical time
    • DDIA_Studying-[TODO]
  • Protocols
    • ApiDesign
      • REST
      • RPC
    • Websockets
    • Serialization
      • Thrift
      • Avro
    • HTTP
    • HTTPS
    • Netty-TODO
  • Statistical data structure
    • BloomFilter
    • HyperLoglog
    • CountMinSketch
  • DevOps
    • Container_Docker
    • Container_Kubernetes-[TODO]
  • Network components
    • CDN
    • DNS
    • Load balancer
    • Reverse proxy
    • 云中网络-TODO
  • Templates
    • interviewRecord
  • TODO
    • RecommendationSystem-[TODO]
    • SessionServer-[TODO]
    • Disk
    • Unix philosophy and Kafka
    • Bitcoin
    • Design pattern
      • StateMachine
      • Factory
    • Akka
    • GoogleDoc
      • CRDT
Powered by GitBook
On this page
  • Components
  • Object
  • Metric
  • Tag
  • Access patterns
  • Storage in HBase
  • Rowkey
  • References
  • 百度
  • Write time series DB from scratch
  • ELK
  • Uber M3
  • Datadog
  • Aggregation

Was this helpful?

  1. Time series scenarios
  2. Observability

TimeSeries data

PreviousObservabilityNextDistributed traces

Last updated 3 years ago

Was this helpful?

Components

  • Time series = Object + Tag + Metrics + actual data

Object

  • Monitoring object could be in three categories:

    • Machine level: Physical machine, virtual machine, operation system

    • Instance level: Container, process

    • Service level (logical object): Service, service group, cluster

Metric

  • Metrics are numeric measurements. Metrics can include:

    • A numeric status at a moment in time (like CPU % used)

    • Aggregated measurements (like a count of events over a one-minute time, or a rate of events-per-minute)

  • The types of metric aggregation are diverse (for example, average, total, minimum, maximum, sum-of-squares), but all metrics generally share the following traits:

    • A name

    • A timestamp

    • One or more numeric values

Tag

  • Annotated key value pairs

Access patterns

  • Sequential read: Read by time range

  • Random write: Different time series data

    • Usually each object has a write sampling frequency is per 5s/10s.

  • Much more write than read

  • Lots of aggregating dimensions

Storage in HBase

Rowkey

Why rowkey is important

  • If rowkey could be designed properly, then data could be distributed evenly into HRegions. And different HRegions could be located in different server nodes.

Row key design

ts = (object, tags) + metric + [(timestamp, value), (timestamp, value), …]

// entity_id is hashed result of combination (object, tags)
// metric_id is hashed result of metric
// timebase is the result of Unix timestamp % 3600, 
//             4 byte length, Rowkey represents 1 hour data. 
RowKey = entity_id + metric_id + timebase

Benefits

  • entity_id and metric_id makes data evenly distributed.

  • timebase makes continous data next to each other.

Support tag aggregation

  • HBase does not have native support for index. This makes it impossible to find all entity_ids given a tag.

  • In the example below:

    • Give a tag: K1=V1, it could find all entities containing the tag: entity_id1, entity_id2, entity_id3

Scaling

Vertical sharding

  • Each product has a different database

Horizontal partitioning

  • Slice name is Product - data - {starttime}

    • startime is the data starting time in table.

    • It will help remove data in batch.

Downsampling

Pre-downsampling

  • The longer the retention period is, the less data could be stored.

Post-downsampling

  • At query time, dynamically downsample data based on user assigned query range.

References

百度

Write time series DB from scratch

  • https://fabxc.org/tsdb/

ELK

  • https://www.twosigma.com/articles/building-a-high-throughput-metrics-system-using-open-source-software/

Uber M3

  • https://eng.uber.com/m3/

Datadog

  • https://www.infoq.com/presentations/datadog-metrics-db/

Aggregation

  • https://www.youtube.com/watch?v=UEJ6xq4frEw&ab_channel=HasgeekTV

Components
Object
Metric
Tag
Access patterns
Storage in HBase
Rowkey
Why rowkey is important
Row key design
Benefits
Support tag aggregation
Scaling
Vertical sharding
Horizontal partitioning
Downsampling
Pre-downsampling
Post-downsampling
References
百度
Write time series DB from scratch
ELK
Uber M3
Datadog
Aggregation
百度大规模时序数据存储(一)| 监控场景的时序数据
百度大规模时序数据存储(二)| 存储选型及数据模型设计
百度大规模时序数据存储(三)| 核心功能设计