Have a feature class in GDB with million level features which store pipes with different diameters. I tried using FeatureLayer with definitionExpression to load them at different scale(small diameters in large scale,large diameters in small scale). The performance is not good. Response time for load this layer is about 10 seconds.
So I want to know what is the proper way to load it?
Many things could slow down or speed up your layers (database configurations, all the way to the patterns in your Javascript). 10 seconds doesn't sound too bad for a large dataset. For some of our larger maps and datasets, I've taken to implementing a custom loading icon whenever any layer in the viewElement.layerViews is 'updating' (by using reactiveUtils).
It doesn't improve performance but at least communicates to the user what to expect.