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

problems getting cache working with laravel app #4825

Open
tormodmacleod opened this issue Feb 11, 2025 · 0 comments
Open

problems getting cache working with laravel app #4825

tormodmacleod opened this issue Feb 11, 2025 · 0 comments

Comments

@tormodmacleod
Copy link

hello,

we have a batch application that runs for several hours and is very read heavy. we used to get good mileage out of the query cache on mysql 5.7 but when they removed that feature we saw that the documentation suggested proxysql. i've configured proxysql to run as a sidecar container in the pod next to the batch process. essentially i want all my reads going through proxysql and to be cached for a very long time. my writes i will probably just send to the mysql host

please see my configuration below

$ cat proxysql.cnf 
datadir="/var/lib/proxysql"

admin_variables=
{
  admin_credentials="sensitive:sensitive;sensitive:sensitive"
  mysql_ifaces="0.0.0.0:6032"
}

mysql_variables=
{
  threads=4
  max_connections=2048
  default_query_delay=0
  default_query_timeout=36000000
  have_compress=true
  poll_timeout=2000
  interfaces="0.0.0.0:3306"
  default_schema="myschema"
  stacksize=1048576
  server_version="5.5.30"
  connect_timeout_server=3000
  monitor_enabled = false
  commands_stats=true
  sessions_sort=true
  connect_retries_on_failure=10
  query_cache_size_MB=256
}

mysql_servers=
(
  {
    address="mysql"
    port=3306
    hostgroup=0
    max_connections=200
  }
)

mysql_users=
(
  {
    username="sensitive"
    password="sensitive"
    default_hostgroup=0
    default_schema="myschema"
    active=1
  }
)

mysql_query_rules=
(
  {
    rule_id=1
    active=1
    match_pattern="^SELECT .*"
    cache_ttl=21600000
    destination_hostgroup=0
    apply=0
  },
)

all my reads are being routed through proxysql as expected but nothing is being cached

mysql> SELECT hostgroup, COUNT(*) AS query_count FROM stats_mysql_query_digest GROUP BY hostgroup;
+-----------+-------------+
| hostgroup | query_count |
+-----------+-------------+
| 0         | 90          |
+-----------+-------------+
1 row in set (0.01 sec)

i understand that proxysql is able to work with prepared statements and i can see that there are entries in the stats_mysql_prepared_statements_info table

mysql> SELECT count(*) FROM stats_mysql_prepared_statements_info;
+----------+
| count(*) |
+----------+
| 842      |
+----------+
1 row in set (0.01 sec)

i'm wondering if i've perhaps misconfigured something and would be grateful for any help or advice

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

1 participant