Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7588339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:53:52+00:00 2026-05-30T19:53:52+00:00

I am working on PHP wrapper for Google Image Charts API service. It supports

  • 0

I am working on PHP wrapper for Google Image Charts API service. It supports serving images from multiple domains, such as:

http://chart.googleapis.com
http://0.chart.googleapis.com
http://1.chart.googleapis.com
...

Numeric range is 0-9, so 11 domains available in total.

I want to automatically track count of images generated and rotate domains for best performance in browser. However Google itself only vaguely recommends:

…you should only need this if you’re loading perhaps five or more charts on a page.

  • What should be my strategy? Should I just change domain every N images and what would good N value be in context of modern browsers?

  • Is there point where it would make sense to reuse domain rather than introduce new one (to save DNS lookup)?

I don’t have specific number of images in mind – since this is open source and publicly available code I would like to implement generic solution, rather than optimize for my specific needs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:53:54+00:00Added an answer on May 30, 2026 at 7:53 pm

    Considerations:

    • Is the one host faster than the other?
    • Does a browser limit connection per host?
    • How long does it take for the browser to resolve a DNS name?

    As you want this to make a component, I’d suggest you make it able to have multiple strategies to find the host name to use. This will not only allow you to have different strategies but also to test them against each other.

    Also you might want to add support for the javascript libraries that can render the data on the page in the future so you might want to stay modular anyway.

    Variants:

    1. Pick one domain name and stick with it, hardcoded: http://chart.googleapis.com
    2. Pick one domain name out of many, stick with it: e.g. http://#.chart.googleapis.com
    3. Like 2 but start to rotate the name after some images.
    4. Like 3 but add some javascript chunk at the end of the page that will resolve the DNS of the missing hostnames in the background so that it’s cached for the next request (Provide the data of the hostnames not used so far).

    Then you can make your library configureable, so you don’t need to hardencode in the code the values but you provide the default configuration.

    Then you can add the strategy as configuration so someone who implements can decide over it.

    Then you can make the component offer to load the configuration from outside, so let’s say, if you create a WordPress plugin, the plugin can store the configuration and offer a plugin user an admin-interface to change the settings.

    As the configuration already includes which strategy to follow you have completely given the responsibility to the consumer of the component and you can more easily integrate different usage-scenarios for different websites or applications.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on a PHP application which is ran from the command
I'm working on an API wrapper class, which is the first I've made. For
I am working on wrapping a C++ API in PHP using SWIG. I am
Working with PHP Xpath trying to quickly pull certain links within a html page.
If you are working in PHP (or I guess any programming language) and using
I am working with php and want to have a page that has a
at my working place (php only) we have a base class for database abstraction.
I've been working with PHP lately, and I came across something I couldn't solve.
I'm working with PHP 5.3 on my local machine and needed to parse a
I'm used to working with PHP but lately I've been working with Java and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.