I just found out that jvm keeps the dns lookup cache until the end so even if i
change the hosts during runtime it wont take affect unless i close and open
jmeter again... The only solution that I found for this problem is to have jvm
not cache at all. You can do that by adding the following param
-Dsun.net.inetaddr.ttl=0 when envoking java. So in our case add this to the
jmeter.bat
if .%JM_LAUNCH% == . set JM_LAUNCH=java.exe -Dsun.net.inetaddr.ttl=0
sebb <[EMAIL PROTECTED]> wrote:
Host name resolution is done either by Java or more likely Windows.
I don't know if you can change how long the names are cached for.
On 12/02/07, jmeter list wrote:
> Hi,
> I'm having a problems with updating a hosts file during my test run and
> making an http request.
>
> Here is and example of the scenario
>
> 1)
> update hosts file to (ip1 is a working ip which should resolve correctly):
> ip1 test_domain
>
> 2) make an http request with test_domain, which resolves to the ip1 and
> returns expected results string
>
> 3)
> update hosts file to (ip2 is a non-working ip which should not resolve or
> return anything):
> ip2 test_domain
>
> 4) make an http request with test_domain, this request also returns the same
> results as step 2 which leads me to believe that somewhere jmeter caches the
> hosts during startup?
>
> At all phases of the test the hosts file is guaranteed to have only one entry
> "ip1 test_domain" or "ip2 test_domain"
>
> I use beanshell to write a new entry to my hosts file:
>
> ====================================
> String pattern = "123.123.123 test_domain";
>
> String fileName = "C:\WINDOWS\\system32\\drivers\\etc\\hosts";
>
> try {
> BufferedWriter out = new BufferedWriter(new FileWriter(fileName));
> out.write(pattern);
> out.close();
> } catch (Exception e) {
> System.out.println(e);
> }
>
> ====================================
>
> The http request is made with an http request sampler which is a get type
> request (keep alive and redirect boxes are not checked)
>
> I also tried using httpclient sampler with no success.
>
> What can i do to have jmeter pickup the hosts change during runtime and only
> during startup?
>
> Thanks,
> Ken
>
>
> ---------------------------------
> Be a PS3 game guru.
> Get your game face on with the latest PS3 news and previews at Yahoo! Games.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------
Don't be flakey. Get Yahoo! Mail for Mobile and
always stay connected to friends.