Saturday, 19 December 2015

Android Studio JVM Error

Error:  android studio was unable to find a valid JVM

Fix:

  •    Go to Applications->Android Studio
  •    Right click and choose Show Package Contents
  •    Open Info.plist
  •    Change the key JVMversion to 1.7* or 1.8* ( depends on which jdk is installed in your mac )

Sunday, 22 November 2015

setColor cocos2dx compile error

Error: setColor cocos2dx compile error

Fix:

  ccColor3B c3 = { 0, 0, 0 };
  selectedImage->setColor(c3);

Saturday, 14 November 2015

Friday, 6 November 2015

Turn ON MySql Event Scheduler feature

By default MySql event scheduler settings are turned OFF. Execute the below commands to turn ON event scheduling in MySql

show variables where variable_name='event_scheduler';

+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | OFF   |
+-----------------+-------+


SET GLOBAL event_scheduler = ON;


show variables where variable_name='event_scheduler';

+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | ON    |
+-----------------+-------+


Monday, 19 October 2015

How to find and kill a process that is using a particular port in ubuntu

1) sudo netstat -lpn |grep :8080
    
      and press Enter

      You can see the PID that occupied the port 8080

2) sudo kill -9 xxxx

      Now you can use the port 8080 for some other application

Memory constraints and limitations of Virtual Private Server

Before you decide to go for Virtual Private Server( VPS ), make your requirements very clear and know the memory limitations of VPS. Long time back I purchased a VPS and I was able to install MySql, Glassfish, Nginx, mail server, puppetmaster and client, memcached, git, etc. Later on I was trying to improve the performance of Glassfish cluster instances and Mysql.
I was able to make changes in memory settings MySql and optimized its performance and tested with mysqltuner. No problem!
Since I had two glassfish cluster instances running on the same machine, I thought of increasing JVM heap size of both instances to 5G. Earlier I had allocated only 2G and I was trying to push this to 5G for both instances.
After making changes in cluster xml, I started 1st instance and it was successful. Instance one was ready to serve requests.
When I try to start the 2nd instance, BOOOOOM!, 2nd instance throws "Out Of Memory Exception", Couldn't reserve enough space for JVM.

Then I checked the available memory in my machine using "free -g". It displayed like this 17G free available memory and only 3G occupied.

What does that mean? 17GB still left but unable to allocate.

Then I spoke to my hosting provider guys and I have been told that it doesn't work the way you think.

This command:
       "cat /proc/user_beancounters" 


You have to investigate the output of the above command to understand why it couldn't allocate 5G to second instance.

Look for this row:
       privvmpages
Check for limit column. That number is the maximum limit that can be allocated to any application. In my case, it was just about 5G. Thats it!
They will not allow you to edit and increase this limit. You have to go for either large vps or a dedicated server to allocate more memory.

Saturday, 17 October 2015

Increase memcached memory limit in ubuntu

Follow the below simple steps to increase memcached memory limit for production use:

1) In Ubuntu, memcached configuration file is located at /etc/



2)  increase the value of -m 64 ( default ) to 2 to 3g.


3) Restart memcached server

                /etc/init.d/memcached restart

Tuesday, 13 October 2015

Display Number of Processors in Linux

The below command spits the number of processors of Linux machine. In Linux, /proc/cpuinfo has all the processor information for all current processors in your machine.

cat /proc/cpuinfo | grep processor | wc -l

or

nproc

or

lscpu gathers cpu architecture information in human readable format

lscpu


Simultaneous TCP connection limitations of Virtual Private Server ( VPS )

Thinking that one VPS machine can handle more than 100k concurrent users, I have configured nginx web server to handle quite a large number of concurrent users and adjusted glassfish web instance max connection, thread pools and acceptor threads to a large and optimized values.
I tested this setup with quite a large number of users but it was not going beyond 3k users concurrently. Finally I came across the network tcp connection limitations of vps server and restrictions made by the hosting providers. In order to make these many number of concurrent users even one dedicated machine is not enough. We need to have a cloud setup.

I don't believe that even a good dedicated server can handle 100k TCP requests
simultaneously. Your vServer is limited by the user_beancounters. You can
check these with

cat /proc/user_beancounters

The numtcpsock parameter will show you how many TCP connections can be handled in parallel.

How to check Java Max Heap Size in Ubuntu


java -XX:+PrintFlagsFinal -version | grep -iE 'HeapSize|PermSize|ThreadStackSize'