The following are the list of improvements done:

Will commit the changes.


On Thu, Dec 3, 2015 at 5:41 PM, Imesh Gunaratne <imesh@apache.org> wrote:


On Thu, Dec 3, 2015 at 10:20 AM, Isuru Haththotuwa <isuruh@apache.org> wrote:

This is in addition to the scheduled executor services we are using. Shall we optimize the StratosThreadPool implementation to dynamically shrink and grow when required? We are currently using fixed thread pools.

+1 




On Sun, Nov 22, 2015 at 12:15 PM, Imesh Gunaratne <imesh@apache.org> wrote:
Hi Akila,

On Sat, Nov 21, 2015 at 1:20 PM, Akila Ravihansa Perera <ravihansa@wso2.com> wrote:

Any idea why thread pools are created per monitor object? Is it not possible to share a common thread pool as per the current design?

No, we do not create a thread pool per monitor object, have a look at the code carefully:

executorService = StratosThreadPool.getExecutorService(
                AutoscalerConstants.MONITOR_THREAD_POOL_ID, threadPoolSize);

The above statement ask Stratos Thread Pool class to return an executor service with the name AutoscalerConstants.MONITOR_THREAD_POOL_ID:

public static ExecutorService getExecutorService(String identifier, int threadPoolSize) {
        ExecutorService executorService = executorServiceMap.get(identifier);
        if (executorService == null) {
            synchronized (executorServiceMapLock) {
                if (executorService == null) {
                    executorService = Executors.newFixedThreadPool(threadPoolSize);
                    executorServiceMap.put(identifier, executorService);
                    log.info(String.format("Thread pool created: [type] Executor Service [id] %s [size] %d", identifier, threadPoolSize));
                }
            }
        }
        return executorService;
    }

This will only create an executor service once for a given identifier.

Thanks
 

Stratos server thread count goes beyond 1500 when deploying 2 or 3 apps. And it keeps growing proportional to the deployed app count. This is a very high resource usage.





Thanks.

--
Akila Ravihansa Perera
WSO2 Inc.;  http://wso2.com/

Blog: http://ravihansa3000.blogspot.com



--
Imesh Gunaratne

Senior Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

--
Thanks and Regards,

Isuru H.






--
Imesh Gunaratne

Senior Technical Lead, WSO2
Committer & PMC Member, Apache Stratos

--
Thanks and Regards,

Isuru H.