========================================
Cryptocurrency Performance Analysis
========================================

Production Resource Usage and Performance Metrics
=================================================

This document provides real-world performance measurements from production cryptocurrency nodes and services running Make Post Sell.

Measurement Methodology
=======================

Commands Used for Analysis
--------------------------

**1. Find Running Processes:**
::

    # List all cryptocurrency-related processes
    ps aux | grep -E "(monero|dogecoin|doge)" | grep -v grep

**2. Basic Process Information:**
::

    # Get process details with memory usage
    ps aux | grep -E "(monero-wallet-rpc|dogecoind)" | grep -v grep | \
        awk '{print $1, $2, $3, $4, $5, $6, $11}'

**3. Detailed Memory Statistics:**
::

    # Get detailed memory stats from /proc filesystem
    echo "=== Monero Wallet RPC (PID $PID1) ===" && \
    cat /proc/$PID1/status | grep -E "(VmSize|VmRSS|VmPeak)"
    
    echo "=== Dogecoind (PID $PID2) ===" && \
    cat /proc/$PID2/status | grep -E "(VmSize|VmRSS|VmPeak)"

**4. Process Uptime and Stability:**
::

    # Check how long processes have been running
    ps -p $PID1,$PID2 -o pid,comm,etime,rss

**5. Convert Memory Values:**
::

    # Convert KB to MB for readability
    echo "scale=2; $KB_VALUE/1024" | bc

Production Measurements
=======================

Test Environment
----------------

- **Date of Measurement**: September 2024
- **System Uptime**: 4+ days for both services
- **Production Load**: Active payment processing
- **Configuration**: Standard Make Post Sell setup

Monero Wallet RPC Performance
-----------------------------

**Configuration**: Remote node (opennode.xmr-tw.org:18089)

**Process Details**:
::

    Command: monero-wallet-rpc --wallet-file=/path/to/mps-wallet \
             --daemon-address=opennode.xmr-tw.org:18089 \
             --trusted-daemon --rpc-bind-ip=127.0.0.1 \
             --rpc-bind-port=18083 --rpc-login=test_user:test_pass

**Resource Usage**:

- **RSS (Resident Set Size)**: 11,136 KB (~10.87 MB)
- **Virtual Memory Size**: 493,508 KB (~481.94 MB)
- **Peak Memory**: 531,908 KB (~519.44 MB)
- **CPU Usage**: 0.0% (idle most of the time)
- **Process Uptime**: 4 days, 14 hours, 54 minutes

**Key Findings**:

1. Extremely lightweight with remote node configuration
2. Minimal active memory usage (~11 MB)
3. No blockchain storage required
4. Stable over extended periods
5. Suitable for resource-constrained environments

Dogecoin Core Performance
-------------------------

**Configuration**: Pruned mode with 2.2GB limit

**Process Details**:
::

    Command: dogecoind
    Config: prune=2200 (2.2GB blockchain storage limit)

**Resource Usage**:

- **RSS (Resident Set Size)**: 161,936 KB (~158.14 MB)
- **Virtual Memory Size**: 3,671,788 KB (~3,585.73 MB)
- **Peak Memory**: 3,903,284 KB (~3,811.80 MB)
- **CPU Usage**: 11.7% (active blockchain validation)
- **Process Uptime**: 4 days, 8 hours, 6 minutes

**Key Findings**:

1. Requires ~4GB RAM during initial sync
2. Settles to ~160MB active memory after sync
3. Higher CPU usage due to blockchain validation
4. Pruned mode saves 99% disk space (2.2GB vs 200GB+)
5. Stable for extended production use

Resource Requirements Summary
=============================

Development Environment
-----------------------

**Minimum Requirements**:

- **Monero (Remote Node)**: 512MB RAM, no disk space
- **Dogecoin (Pruned)**: 4GB RAM, 2.2GB disk space

**Recommended**:

- **Monero (Remote Node)**: 1GB RAM for comfort
- **Dogecoin (Pruned)**: 6GB RAM for faster sync

Production Environment
----------------------

**After Initial Sync**:

- **Monero Wallet RPC**: ~11MB active memory
- **Dogecoin Core**: ~160MB active memory
- **Combined**: Less than 200MB active memory

**During Operations**:

- Payment processing adds minimal overhead
- Auto-sweep operations are memory-efficient
- Multiple shops share the same services

Performance Optimization Tips
=============================

Monero Optimization
-------------------

1. **Use Remote Nodes for Development/Small Deployments**
   ::

       # Lightweight option - no blockchain required
       --daemon-address=opennode.xmr-tw.org:18089

2. **Local Node for High-Volume Production**
   ::

       # Better privacy and reliability, but needs 150GB+ disk
       --daemon-address=127.0.0.1:18081

3. **Memory Optimization**
   ::

       # Limit transaction history if memory-constrained
       --max-concurrency=1

Dogecoin Optimization
---------------------

1. **Pruned Mode Configuration**
   ::

       # In dogecoin.conf
       prune=2200  # Minimum for wallet functionality
       
       # Can increase for better performance
       prune=5000  # 5GB limit

2. **Database Cache Tuning**
   ::

       # Reduce memory usage (default 300MB)
       dbcache=100
       
       # Or increase for better performance
       dbcache=1000

3. **Connection Limits**
   ::

       # Reduce peer connections to save resources
       maxconnections=8

Monitoring Commands
===================

Real-time Monitoring
--------------------

**Memory Usage Over Time**:
::

    # Monitor every 5 seconds
    watch -n 5 'ps aux | grep -E "(monero|doge)" | grep -v grep'

**Detailed Memory Breakdown**:
::

    # Show memory maps
    pmap -x $PID | tail -1

**Resource Limits**:
::

    # Check process limits
    cat /proc/$PID/limits

Performance Logging
-------------------

**Create Monitoring Script**:
::

    #!/bin/bash
    # Save as monitor_crypto.sh
    
    LOG_FILE="/var/log/crypto_performance.log"
    
    while true; do
        echo "=== $(date) ===" >> $LOG_FILE
        ps aux | grep -E "(monero|doge)" | grep -v grep >> $LOG_FILE
        echo "" >> $LOG_FILE
        sleep 300  # Log every 5 minutes
    done

**Analyze Performance Trends**:
::

    # Average memory usage
    awk '/monero-wallet-rpc/ {sum+=$6; count++} END {print sum/count}' $LOG_FILE
    
    # Peak memory usage
    awk '/dogecoind/ {if($6>max) max=$6} END {print max}' $LOG_FILE

Troubleshooting High Resource Usage
====================================

Monero Wallet RPC
-----------------

**Symptoms**: High memory usage with remote node

**Diagnosis**:
::

    # Check wallet cache size
    du -sh ~/.bitmonero/

**Solution**:
::

    # Clear transaction cache
    monero-wallet-cli --wallet-file=/path/to/wallet
    > rescan_bc hard

Dogecoin Core
-------------

**Symptoms**: Excessive memory during sync

**Diagnosis**:
::

    # Check sync progress
    dogecoin-cli getblockchaininfo | grep -E "(blocks|headers|progress)"

**Solution**:
::

    # Reduce database cache during sync
    dogecoin-cli stop
    # Add to dogecoin.conf: dbcache=50
    dogecoind

Capacity Planning
=================

Scaling Considerations
----------------------

**Per-Shop Resource Impact**:

- Monero: Negligible (shared wallet RPC)
- Dogecoin: Negligible (shared node)
- Database: ~1MB per 1000 payments

**High-Volume Recommendations**:

1. **10-100 shops**: Single server sufficient
2. **100-1000 shops**: Consider dedicated database
3. **1000+ shops**: Multiple crypto nodes with load balancing

**Resource Scaling Formula**:
::

    # Rough estimates
    RAM_needed = base_requirement + (shops * 0.1MB) + (daily_payments * 0.01MB)
    
    # Example: 100 shops, 1000 daily payments
    Monero: 512MB + 10MB + 10MB = 532MB
    Dogecoin: 4GB + 10MB + 10MB = 4.02GB

Conclusion
==========

The cryptocurrency infrastructure for Make Post Sell is remarkably efficient:

1. **Monero with remote node**: Production-ready with just 11MB active memory
2. **Dogecoin pruned mode**: Requires 4GB during sync but only 160MB ongoing
3. **Combined footprint**: Less than 200MB RAM for active operations
4. **Proven stability**: 4+ days continuous operation without issues

This performance profile makes Make Post Sell suitable for deployment on modest VPS instances while maintaining the ability to scale to high-volume operations.