support debug mode for data analysis
optimize debug mode for data analysis
support shutdown and close.