Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

How to debug OpenSpecimen slowness?

Specific OpenSpecimen feature is slow

First thing to check would be: if the overall application is slow or a specific feature is slow? If the overall application is slow, then check the other sections in this page.

If a specific feature is slow, then it could mean:

a. A DB index is missing

b. A code level improvement needs to be done

Contact Krishagni for support in such cases.

Windows or Linux?

If Windows, consider moving to Linux. Windows is not an ideal operating system if you have many users & labs.

Is DB and App on different servers?

If not, consider moving DB to a different server.

Check Tomcat memory allocation

Tomcat should be assigned 2GB memory to run optimally.  Open the 'setenv.sh' file in the '<tomcat directory>/bin' directory, and check if -Xmx2048m is present in the below line.

export JAVA_OPTS="-Dfile.encoding=UTF-8 -Xms128m -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=512m"

Check DB memory allocation

Please refer to "Increase memory for better query performance" in MySQL prerequisites page. If Oracle, consult your DBA.

Check CPU and memory utilization.

  • Open Task Manager (Windows) or top command (Linux).
  • Check if any process entirely consumes CPU or memory. If some process is hogging all the resources, identify the process, and check what is going on with it.
  • Repeat this on both app and DB server.

Check database transactions

  • Login into the database.
  • Run the following command for MySQL: 
show full processlist;
  • It will display current running transactions in the database.
  • Check if any of the processes are long-running or hogging all the DB resources.
  • If yes, identify the query and check if it was run by OpenSpecimen application.

If OpenSpecimen all services are running, but the app is not loading, then collect the below information(In case of Lock error).

  1. Check DB transactions using the above query. Check long-running queries. Store those queries in the text file. (Make sure you have connected to OpenSpecimen using user to the MySQL)
  2. Take a heap dump. (Check process ID using the ps -ef | grep tomcat)
jmap -dump:format=b,file=/path/to/dumpfile.hprof <pid>

       3. Take jstack:

jstack -l <pid> > thread_dump.txt

      4. Check any external tread connected to MySQL. (The count of the below output and show full processlist should be same, if not external thread is connected.)

netstat -ant | grep 3306

      5. Check Open tables

show open tables where in_use > 0;

       6. Check innodb status

show engine innodb status

        7. Check isolation

show variables like '%isolation%';
Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com