influxdata / influxdb-java

Java client for InfluxDB
MIT License
1.18k stars 477 forks source link

InfluxDBFactory.connect() takes 0.5 seconds #325

Closed tobyfan1980 closed 6 years ago

tobyfan1980 commented 7 years ago

I tried with localhost. 0.5 second is unreasonable.

I dig in and find that the following line in bold in InfluxDBImpl constructor takes most of the time. What happened here?

public InfluxDBImpl(String url, String username, String password, Builder client) { this.logLevel = LogLevel.NONE; this.hostAddress = this.parseHostAddress(url); this.username = username; this.password = password; this.loggingInterceptor = new HttpLoggingInterceptor(); this.loggingInterceptor.setLevel(Level.NONE); this.gzipRequestInterceptor = new GzipRequestInterceptor(); this.retrofit = (new retrofit2.Retrofit.Builder()).baseUrl(url).client(client.addInterceptor(this.loggingInterceptor).addInterceptor(this.gzipRequestInterceptor).build()).addConverterFactory(MoshiConverterFactory.create()).build(); this.influxDBService = (InfluxDBService)this.retrofit.create(InfluxDBService.class); }

majst01 commented 7 years ago

Can you please elaborate more details about your actual setup: