RDS databases have DNS names. The primary DB and read replicas have different DNS names.

  1. Does my code need to have access to the read replicas and if yes then in what way? 2)Once I have created my read replicas, is it automatic that my read throughput will be scaled out or does one make other configurations?
1 Answer

Although read replicas are not necessary required for your code to access them, it is strongly advised that you use them to divert read traffic away from the main database. You can enhance the functionality of your program and lighten the load on your main database by doing this. You can use the read replicas' DNS names to connect to them straight from your code in order to reach read replicas. For example, the MySQL command-line client or JDBC/ODBC drivers can be used to link to the read replicas.

Your read throughput will be scaled out automatically once your read replicas have been made. To guarantee that your application can benefit from the read, there are a few things you can do.

Update your application code to use the DNS names of the read replicas.

Distribute read traffic across the read replicas to avoid overloading any single read replica.

Use a load balancer to distribute read traffic across multiple read replicas.

Use read-only transactions to ensure that read traffic goes to the read replicas and not the primary database.

answered 8 days ago
  • Given this is your code for connecting to the db

    spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:123456} spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:mysql://test.c492osb3*******:3306/test} spring.datasource.username=${SPRING_DATASOURCE_USERNAME:ABCD}

    How would you configure the read replicas?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions