🐝
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
  • Security
  • Transmission security
  • Storage security
  • Content security
  • [Nice-have nonfunctional features] Perf for multi-media
  • Upload
  • Send
  • Network stability

Was this helpful?

  1. Scenarios
  2. Instant messenger

NonFunc-Security

PreviousNonFunc-OrderingNextLivecast-LinkedIn

Last updated 3 years ago

Was this helpful?

Security

Transmission security

  • Entrance security:

    • Router's DNS hijacked: DNS location is set to a location with virus.

    • Operator's local DNS hijacked:

      • Operator might send DNS requests to other operators to reduce the resource consumption

      • Operator might modify the TTL for DNS

    • Ways to prevent DNS from being hijacked

      • HttpDNS protocol: Prevent domain name from being hijacked by operators. It uses HTTP protocol instead of UDP to directly interact with DNS servers.

      • Combine HttpDNS with localDNS.

  • TLS transmission layer security:

    • Cut off network

      • Failover to multiple connection IP address returned by HttpDNS service

      • Change from UDP based QUIC protocol to TCP protocol

    • Intercept/Man in the middle/Forfeit: Use TLS protocol

      • Insymetric encryption and key exchange algorithm are used to guarantee message encryption key not being corrupted or leaked.

      • Symmetric encryption is used to guarantee that the msg could not be decrypted after being intercepted.

      • Digital signature and CA certificate could be used to verify the valid status of public key.

Storage security

  • Account credentials: Hashing algorithm with salt.

  • Message security: End to end encryption

Content security

  • Link to external phishing website

  • Crawler

[Nice-have nonfunctional features] Perf for multi-media

Upload

  • Picture/Video/Voice:

    • Picture/Video media: Have a dedicated channel for video and picture media. After media (video/picture) is uploaded to the storage, a unique ID will be generated and used along with messages.

    • Voice media:There is no miniature for preview. Voice media will be transmitted in the same channel as message team.

  • Divide and send:

    • Size of the divide: Divide too big, not enough parrallelism; Divide too small, too many TCP connections and increased cost for merge.

    • Typical size of pieces: WiFi 2M; 4G 1M; 3G/2G 256K.

    • Since the size of media is big, it will be beneficial to divide and retransmit.

  • Dedupe the media

    • Compute the hash for media before uploading

Send

  • Prerequisites for supporting watch while send

    1. Format and key frame info is at the top of file.

    2. Storage support range queries.

      • Ali OSS / Tencent COS, support range queries

      • Utilize load balance layer range query. (Nginx HTTP Slice)

  • CDN

    • Encryption with HLS.

  • Compression

    • Image compression

      • Adaptive resolution

      • WebP: WebP is roughly 30% smaller than PNG/JPEG. Cons is not easy to be integrated on iOS platform / JPEG

      • JPEG: Two types of JPEG ???

    • Video:

      • H.265 is 50% less than H.264. But encoding/decoding much more time consuming.

Network stability

  • Use public allowed ports when possible: 80, 8080, 443, 14000

  • Http Tunnel: Use Http protocol to encapsulate other incompatible protocols

  • Multi IP addresses: Rely on HttpDNS to return multiple IP addresses

  • Connection fast

    • Reduce the latency among multi network operators

    • Race among multiple endpoints: After multiple IP addresses returned by HttpDNS, benchmark against different endpoints.

  • Separating upload and download tunnel:

    • In case of broadcasting, there will be lots of msgs being sent in the downward channel.

    • Could use short connection in upload channel, long connection in download channel.

Security
Transmission security
Storage security
Content security
[Nice-have nonfunctional features] Perf for multi-media
Upload
Send
Network stability