Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] How to increase Redis Cache Hit Ratio? #12734

Open
devjaythakkar opened this issue Nov 7, 2023 · 1 comment
Open

[QUESTION] How to increase Redis Cache Hit Ratio? #12734

devjaythakkar opened this issue Nov 7, 2023 · 1 comment

Comments

@devjaythakkar
Copy link

devjaythakkar commented Nov 7, 2023

Here are all the info stats
"total_connections_received" => "329"
"total_commands_processed" => "77333"
"instantaneous_ops_per_sec" => "123"
"total_net_input_bytes" => "12987896"
"total_net_output_bytes" => "960654"
"instantaneous_input_kbps" => "18.98"
"instantaneous_output_kbps" => "0.60"
"rejected_connections" => "0"
"sync_full" => "0"
"sync_partial_ok" => "0"
"sync_partial_err" => "0"
"expired_keys" => "17"
"expired_stale_perc" => "0.06"
"expired_time_cap_reached_count" => "0"
"expire_cycle_cpu_milliseconds" => "25"
"evicted_keys" => "0"
"keyspace_hits" => "1748"
"keyspace_misses" => "16554"
"pubsub_channels" => "0"
"pubsub_patterns" => "0"
"latest_fork_usec" => "433"
"migrate_cached_sockets" => "0"
"slave_expires_tracked_keys" => "0"
"active_defrag_hits" => "0"
"active_defrag_misses" => "0"
"active_defrag_key_hits" => "0"
"active_defrag_key_misses" => "0"
"tracking_total_keys" => "0"
"tracking_total_items" => "0"
"tracking_total_prefixes" => "0"
"unexpected_error_replies" => "0"
"total_reads_processed" => "55734"
"total_writes_processed" => "55406"
"io_threaded_reads_processed" => "0"
"io_threaded_writes_processed" => "0"

PHP Version
8.0

Laravel Version
8.0

My config setup in Laravel
'redis' => [

    'client' => env('REDIS_CLIENT', 'predis'),

    'options' => [
        'cluster' => env('REDIS_CLUSTER', 'redis'),
        'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
        'scheme' => env('REDIS_SCHEME', 'tcp'),
    ],

    'default' => [
        'url' => env('REDIS_URL'),
        'host' => env('REDIS_HOST', '127.0.0.1'),
        'password' => env('REDIS_PASSWORD', null),
        'port' => env('REDIS_PORT', '6379'),
        'database' => env('REDIS_DB', '0'),
        'scheme' => env('REDIS_SCHEME', 'tcp'),
        'path' => env('REDIS_PATH', ''),

    ],

    'cache' => [
        'url' => env('REDIS_URL'),
        'host' => env('REDIS_HOST', '127.0.0.1'),
        'password' => env('REDIS_PASSWORD', null),
        'port' => env('REDIS_PORT', '6379'),
        'database' => env('REDIS_CACHE_DB', '1'),
        'scheme' => env('REDIS_SCHEME', 'tcp'),
        'path' => env('REDIS_PATH', ''),
    ],
],

I want to decrease the keyspace_misses and increase the keyspace_hits, I have tried many thing but not a single one work for me. Can anyone help me?

@AMX0013
Copy link

AMX0013 commented Apr 16, 2024

Might be usecase specific since no keys were evicted "evicted_keys" => "0" and the keyspace misses just mean that there were roughly 16554 new keys created, and only 17 of them expired based on their TTL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants