title: Sping Cloud Config Client Performance
body: <p>I recently learned how to setup a Spring Cloud Config Server/Client. But I have a doubt regarding its performance.</p>
  <p>So previously we used to use property files on the local server and read that. But since we have about 40 servers to deal with we decided to move to Spring Cloud.</p>
  <p>So my question was about fetching the properties in the code. Currently I am having to write code, that opens a <code>HttpURLConnection</code> to fetch the properties. Something like this:</p>
  <pre><code>URL url = new URL(REST_URL);
  HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
  
  httpURLConnection.setRequestMethod(&quot;GET&quot;);
  httpURLConnection.setDoOutput(true);
  httpURLConnection.setDoInput(true);
  httpURLConnection.setRequestProperty(&quot;Content-Type&quot;, &quot;text/plain&quot;);
  
  String username = &quot;admin&quot;;
  String password = &quot;admin&quot;;
  
  String encoding = username + &quot;:&quot; + password;
  String encodedString = Base64.getEncoder().encodeToString(encoding.getBytes());
  
  httpURLConnection.setRequestProperty(&quot;Authorization&quot;, &quot;Basic &quot; + encodedString);
  
  httpURLConnection.connect();
  
  InputStream inputStream = httpURLConnection.getInputStream();
  
  String text = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)).lines().collect(Collectors.joining(&quot;\n&quot;));
  </code></pre>
  <p>My Rest URL is something like <code>http://localhost:8080/pcc/aapEnv</code> if I want to fetch the property value of <code>aapEnv</code>.</p>
  <p>So tested this code out and found out that it takes around 260 ms on average to fetch the values. I am sure fetching properties from property files would be fraction of that.</p>
  <p>So to implement this, I was wondering that to store the property in POJO Bean class at server startup. Is there a better way of achieving this? Or the slower time, is just a trade-off when using centralized servers and we have to learn to live with it?</p>
  <p>Any pointers would be helpful.</p>