Skip to main content

Overview

TeamSpeak 6 Server provides several configuration options to optimize performance for your specific hardware and workload. This guide covers thread configuration, database connection pooling, buffer settings, and other performance-related parameters.

Voice Processing Threads

The server uses multiple threads to process voice data. Adjusting the thread count can significantly impact performance.

Voice UDP Threads

threads-voice-udp
integer
default:"5"
Number of threads to use for voice processing.Range: 1 - 16Environment Variable: TSSERVER_VOICE_UDP_THREADS
server:
  threads-voice-udp: 5
./tsserver --threads-voice-udp 5

Optimal Thread Configuration

The optimal number of voice threads depends on your hardware:
CPU CoresConcurrent UsersRecommended Threads
2-4< 502-3
4-850-2004-6
8-16200-5006-10
16+500+10-16
Start with the default value (5) and increase if you notice voice quality issues during high load. Monitor CPU usage to ensure you’re not over-threading.

Thread Tuning Guidelines

Increase threads when:
  • CPU usage is high but cores aren’t fully utilized
  • Voice quality degrades during peak usage
  • Server handles many simultaneous talkers
  • Running on multi-core systems (8+ cores)
Decrease threads when:
  • Running on limited CPU resources (VPS, containers)
  • Server has few concurrent users (< 50)
  • Context switching overhead is high
  • Other services share the same CPU
Setting too many threads can actually decrease performance due to context switching overhead. More threads isn’t always better.

Database Connection Pool

The database connection pool manages connections between the server and database. Proper sizing is crucial for performance.

Connection Pool Size

db-connections
integer
default:"10"
Number of connections to establish to the database.Range: 2 - 100Environment Variable: TSSERVER_DATABASE_CONNECTIONS
server:
  database:
    connections: 10
./tsserver --db-connections 10

Sizing Database Connections

Connection pool sizing depends on your workload:
ScenarioUsersVirtual ServersRecommended Connections
Small< 1001-25-10
Medium100-5003-1010-20
Large500-200010-5020-50
Enterprise2000+50+50-100

Connection Pool Best Practices

  1. Start conservative: Begin with default (10) and increase based on monitoring
  2. Monitor usage: Track active connections vs. available connections
  3. Database limits: Ensure database server supports total connections across all instances
  4. Multi-instance setups: Total connections = connections per instance × number of instances
For multi-instance deployments sharing a database, ensure your database server’s max_connections is higher than the sum of all instance connection pools.

Database Connection Timeout

db-timeout
integer
default:"10"
Timeout in seconds when connecting to the database.Range: 1 - 432000 (5 days)Environment Variable: TSSERVER_DATABASE_TIMEOUT
server:
  database:
    config:
      timeout: 10
Increase timeout for database servers over high-latency network connections. Decrease for local databases to fail fast on issues.

Query Interface Performance

Query Pool Size

query-pool-size
integer
default:"2"
Number of threads to use for Server Query command processing.Range: 2 - 32Environment Variable: TSSERVER_QUERY_POOL_SIZE
server:
  query:
    pool-size: 2
./tsserver --query-pool-size 2

Query Pool Sizing

Query LoadConcurrent ConnectionsRecommended Pool Size
Light1-52-4
Moderate5-204-8
Heavy20-508-16
Very Heavy50+16-32
Query pool size should match your concurrent Server Query usage patterns. If you primarily use Server Query for occasional administration, keep this low. If you have automated systems constantly querying the server, increase accordingly.

Query Buffer Size

query-buffer-mb
integer
default:"20"
Memory (in MB) to allocate for Server Query connection buffering.Range: 20 - 100Environment Variable: TSSERVER_QUERY_BUFFER_MB
server:
  query:
    buffer-mb: 20
./tsserver --query-buffer-mb 20
Increasing buffer size uses more memory. Only increase if you’re processing large Server Query responses or experiencing buffer-related errors.

Query Timeout

query-timeout
integer
default:"300"
Timeout in seconds before Server Query connections are automatically closed due to inactivity.Environment Variable: TSSERVER_QUERY_TIMEOUT
server:
  query:
    timeout: 300

Performance Monitoring

Query Statistics Logging

query-log-timing
integer
default:"3600"
Interval in seconds to log Server Query performance statistics.Range: 10 - 31556952 (1 year)Environment Variable: TSSERVER_QUERY_LOG_TIMING
server:
  query:
    log-timing: 3600
Statistics logged include:
  • Total queries processed
  • Average query execution time
  • Slow queries
  • Connection pool usage
Enable query timing logs to identify performance bottlenecks. Review logs periodically to optimize configuration.

Database Performance

Query Logging

db-log-queries
boolean
default:"false"
Enables logging of all SQL queries.Environment Variable: TSSERVER_DATABASE_LOG_QUERIES
server:
  database:
    config:
      log-queries: 0
Performance Impact: Query logging significantly increases I/O and log file size. Only enable for debugging database performance issues.

SQLite Integrity Check

db-skip-integrity-check
boolean
default:"false"
Skips SQLite database integrity check at startup.Environment Variable: TSSERVER_DATABASE_SKIP_INTEGRITY_CHECK
server:
  database:
    config:
      skip-integrity-check: 0
Integrity checks add startup time but ensure database health. Only skip for large databases where startup time is critical and you have other validation methods.

Database Client Cleanup

db-client-keep-days
integer
default:"30"
Number of days to keep inactive client records in the database.Environment Variable: TSSERVER_DATABASE_CLIENT_KEEP_DAYS
server:
  database:
    client-keep-days: 30
Reducing retention period:
  • Decreases database size
  • Improves query performance
  • Reduces backup size and time
For high-churn servers (many temporary users), reduce retention to 7-14 days. For community servers where history matters, increase to 90+ days.

System-Level Optimization

Process Priority

Increase server process priority:
# Linux: Run with higher priority
nice -n -10 ./tsserver

# Or use systemd Nice parameter
[Service]
Nice=-10

File Descriptor Limits

Increase file descriptor limits for high-concurrency:
# Check current limit
ulimit -n

# Increase for current session
ulimit -n 65535

# Permanent change in /etc/security/limits.conf
tsserver soft nofile 65535
tsserver hard nofile 65535

Memory Settings

Ensure sufficient memory is available:
# Monitor memory usage
top -p $(pidof tsserver)

# Or use htop
htop -p $(pidof tsserver)
Memory requirements (approximate):
  • Base server: 50-100 MB
  • Per virtual server: 10-20 MB
  • Per connected user: 0.5-2 MB

Disk I/O Optimization

For SQLite databases:
# Use faster storage (SSD)
# Enable write-ahead logging (WAL mode)
sqlite3 ts3server.sqlitedb "PRAGMA journal_mode=WAL;"
For MariaDB:
  • Place database on SSD storage
  • Optimize database server configuration
  • Use connection pooling
  • Enable query caching

Network Performance

TCP Settings

Optimize TCP settings for Server Query:
# Linux kernel tuning
sudo sysctl -w net.ipv4.tcp_fin_timeout=30
sudo sysctl -w net.ipv4.tcp_keepalive_time=300
sudo sysctl -w net.ipv4.tcp_keepalive_probes=5
sudo sysctl -w net.ipv4.tcp_keepalive_intvl=15

UDP Buffer Sizes

Increase UDP buffer sizes for voice traffic:
# Increase UDP receive buffer
sudo sysctl -w net.core.rmem_max=8388608
sudo sysctl -w net.core.rmem_default=262144

# Increase UDP send buffer
sudo sysctl -w net.core.wmem_max=8388608
sudo sysctl -w net.core.wmem_default=262144

Monitoring and Metrics

Key Metrics to Monitor

  1. CPU Usage
    • Per-core utilization
    • Context switches
    • Thread count
  2. Memory Usage
    • Resident memory (RSS)
    • Virtual memory
    • Memory growth over time
  3. Database Performance
    • Connection pool utilization
    • Query execution time
    • Slow queries
  4. Network
    • Bandwidth usage
    • Packet loss
    • Connection count
  5. Voice Quality
    • Codec latency
    • Packet jitter
    • Voice buffer underruns

Monitoring Tools

# Real-time monitoring
htop
iotop
iftop

# Log analysis
tail -f logs/ts3server_*.log | grep -E 'ERROR|WARNING'

# Server Query monitoring
serverinfo
clientlist
channellist

Performance Benchmarking

Load Testing

  1. Simulate users with automated clients
  2. Monitor metrics during test
  3. Identify bottlenecks (CPU, memory, network, database)
  4. Adjust configuration based on results
  5. Retest to verify improvements

Configuration Testing Matrix

Test different configurations:
TestVoice ThreadsDB ConnectionsQuery PoolResult
Baseline5102(measure)
Test 18102(compare)
Test 25202(compare)
Test 38204(compare)

Optimization Checklist

Initial Setup

  • Configure voice threads based on CPU cores
  • Size database connection pool appropriately
  • Set query pool size for expected Server Query load
  • Configure client retention period
  • Enable query timing logs

Regular Maintenance

  • Monitor resource usage weekly
  • Review slow queries monthly
  • Analyze query timing logs
  • Check database size and growth rate
  • Verify backup and restore performance

Performance Issues

  • Review recent configuration changes
  • Check system resource availability
  • Analyze database query performance
  • Monitor network latency and packet loss
  • Review server logs for errors or warnings

Troubleshooting Performance Issues

High CPU Usage

  1. Check thread configuration:
    • Reduce voice threads if context switching is high
    • Verify thread count matches CPU cores
  2. Disable expensive features:
    server:
      hints-enabled: 0  # Disable permission hints
      database:
        config:
          log-queries: 0  # Disable query logging
    
  3. Review permission complexity:
    • Simplify permission hierarchies
    • Reduce client-specific permissions

High Memory Usage

  1. Reduce buffer sizes:
    server:
      query:
        buffer-mb: 20
    
  2. Limit connection pools:
    server:
      database:
        connections: 10
      query:
        pool-size: 2
    
  3. Check for memory leaks:
    • Monitor memory growth over time
    • Restart server regularly if leak suspected
    • Update to latest version

Database Performance Issues

  1. Optimize connection pool:
    server:
      database:
        connections: 20  # Increase if pool exhausted
        config:
          timeout: 30  # Increase for slow networks
    
  2. Database maintenance:
    # SQLite: Vacuum database
    sqlite3 ts3server.sqlitedb "VACUUM;"
    
    # SQLite: Analyze tables
    sqlite3 ts3server.sqlitedb "ANALYZE;"
    
  3. Consider migration:
    • SQLite → MariaDB for better concurrency
    • Local DB → Remote DB with faster hardware

Network Performance Issues

  1. Check network configuration:
    # Test latency
    ping -c 10 <server-ip>
    
    # Test bandwidth
    iperf3 -c <server-ip>
    
  2. Optimize UDP settings:
    • Increase UDP buffer sizes (see Network Performance section)
    • Check for packet loss
    • Verify QoS settings
  3. Review voice thread configuration:
    server:
      threads-voice-udp: 8  # Increase for high load
    

Build docs developers (and LLMs) love