Tuesday, 25 April 2017
Saturday, 12 November 2016
Load testing on single server
Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled
exception.
Exception Info: System.AccessViolationException
at
System.Threading.Thread.InternalCrossContextCallback(System.Runtime.Remoting.Contexts.Context,
IntPtr, Int32, System.Threading.InternalCrossContextDelegate, System.Object[])
at
System.Runtime.Remoting.Channels.CrossContextChannel.SyncProcessMessage(System.Runtime.Remoting.Messaging.IMessage)
at
System.Runtime.Remoting.Proxies.RemotingProxy.CallProcessMessage(System.Runtime.Remoting.Messaging.IMessageSink,
System.Runtime.Remoting.Messaging.IMessage,
System.Runtime.Remoting.Contexts.ArrayWithSize, System.Threading.Thread,
System.Runtime.Remoting.Contexts.Context, Boolean)
at
System.Runtime.Remoting.Proxies.RemotingProxy.InternalInvoke(System.Runtime.Remoting.Messaging.IMethodCallMessage,
Boolean, Int32)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(System.Runtime.Remoting.Proxies.MessageData
ByRef, Int32)
at .....followed by application exception When I was running my load tests using JMeter against a single server (usually against a load balancer but for some reason wanted to know the)I happened to get this weird error repeatedly with 100% error rate in Jmeter. The application I was testing was a WCF service hosted on IIS.
My first instinct was to check if the error had occurred because of my recent changes, I checked the event viewer which told me that this error was occurring very rarely.
It took a lot of googling and ended up with nothing, so I decided to check on the IIS 7 configuration.
I found the root cause of the failure, it was due to few configurations that had to be changed in IIS.
Configuration:
IIS Queue Length: The default value is 1000, so after 1000 active connections any new connections will be served a 503 Error.
IIS rapid fail protection: By default the value is set as true. So after 5 application errors, the app pool goes down.
To sum it up, since I ran the load test for 'n' Users. The default IIS Queue size is overloaded with many requests crossing the default 1000 queue size which returns application errors our and the other config “Rapid Fail Protection” pulls down the app pool.
This error has occurred only because I load tested on a single server with a connection limit of 1000 in the IIS.
I increased the queue size to the max value of 9000 and disabled the Rapid Fail Protection and Ran the same LOAD TEST. It FIXED the problem and worked well as I saw a error rate of less than 0.3% for a very large sample and the above error never occurred again. Turns out it only occurred because I ran the load test against a single server. But it did point out to me that all the servers had a default value of 1000 Queue size and in case of an actual load all the servers would have gone crashing down.
So to conclude the above error was a memory error I believe. If you faced the same error please post below on what you did to fix it.
Here are the configurations for IIS 7.0 as suggested by Microsoft. Be careful in whatever you need for your application, not all is good for you.
Labels:
LoadTesting,
Softwares
Monday, 7 November 2016
SoapUI hosting on Tomcat error
06-Nov-2016 14:18:34.624 SEVERE [http-nio-9092-exec-2] org.apache.catalina.core.ApplicationContext.log StandardWrapper.Throwable
java.lang.NoClassDefFoundError: Could not initialize class com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport
at com.eviware.soapui.DefaultSoapUICore.initSettings(DefaultSoapUICore.java:361)
at com.eviware.soapui.DefaultSoapUICore.init(DefaultSoapUICore.java:129)
at com.eviware.soapui.DefaultSoapUICore.<init>(DefaultSoapUICore.java:114)
at com.eviware.soapui.mockaswar.MockAsWarServlet$MockServletSoapUICore.<init>(MockAsWarServlet.java:317)
at com.eviware.soapui.mockaswar.MockAsWarServlet.init(MockAsWarServlet.java:71)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:779)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:133)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
java.lang.NoClassDefFoundError: Could not initialize class com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport
at com.eviware.soapui.DefaultSoapUICore.initSettings(DefaultSoapUICore.java:361)
at com.eviware.soapui.DefaultSoapUICore.init(DefaultSoapUICore.java:129)
at com.eviware.soapui.DefaultSoapUICore.<init>(DefaultSoapUICore.java:114)
at com.eviware.soapui.mockaswar.MockAsWarServlet$MockServletSoapUICore.<init>(MockAsWarServlet.java:317)
at com.eviware.soapui.mockaswar.MockAsWarServlet.init(MockAsWarServlet.java:71)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:779)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:133)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
This is the error I happened to get on SOAPUI 5.2.1 on trying to deploy a war file containing mock service on Apache Tomcat 8.5.
This issue is caused because the hosting service is unable to find some jar files required to host the service. This can be FIXed by ensuring soapUI has internet access. Once I ran this on a system having internet access, it worked fine.
If you have a system without internet access, you can use the SOAPUI itself to host the mock service and disable logging, it is good enough to run a Load Test on it. Response time I saw was 0.1ms .
Friday, 4 November 2016
Managing VirtualBox Better
Getting the better out of the painful VM – Virtual Box
After struggling a long time with VM with slow speed and
frequent crashes. I found few tips from various websites which helps the VM run
in a better way.
This post contains the following.
- · Tweaks for a better VM
- · Installing Ubuntu or any other Linux/OS on Oraclebox.
- · Misc
Below are a few tweaks that can be done to prevent VM
from getting crashed and to make it perform better.
(It would be better if you have the fresh vmdk file before
applying the following settings.)
Go to
machine-> settings-System.
Set Base Memory to the max green level.
Switch to Processor Tab
Set the CPU as 2 or the green level.
Set the execution Cap below it to 100%
Switch to Acceleration Tab
Set both Option in Hardware Virtualization to
checked.
Go to Display
set Video memory to 128 mb in the video tab
Other things to do:
- · Take a snapshot of the fresh install (initial install) – You can restore to any previous snapshot and prevent the loss of your entire vm
- · Run Disk Defragmenter every week on your VM.
- · Save the machine state, do not shutdown everytime.
- · Always choose fixed disk size to prevent space and performance issues.
In case of network issues:
Go to machine -> settings -> Network
Change Adapter 1 to Attached to : Bridged (works
sometimes- this is due to network issues.)
Installing a linux VM
on your own.
Download Ubuntu or any linux distro iso file .
http://linuxlookup.com/linux_iso
· Start VMware.
· From the File menu select "Create a New Virtual Machine"
· Choose to install the operating system later. Click "Next".
· Select Linux as the "Guest Operating System" and then choose Ubuntu as the "Version". Click "next".
· Provide a "Virtual machine name" and "Location" where the machine will be stored on the Windows host. The defaults are fine here. Click "Next".
· For "Maximum disk size (GB)" it is good to start with 40G if possible. This means that it will take up 40G on the Windows host. Make sure that the Windows host has at least this much before proceeding. It is also a good practice to tell VMware to split the virtual disk into 2G files. This will makes the image easier to copy and transport if necessary. Click "Next".
· Click "Finish" to complete the creation of the virtual machine.
· Select Linux as the "Guest Operating System" and then choose Ubuntu as the "Version". Click "next".
· Provide a "Virtual machine name" and "Location" where the machine will be stored on the Windows host. The defaults are fine here. Click "Next".
· For "Maximum disk size (GB)" it is good to start with 40G if possible. This means that it will take up 40G on the Windows host. Make sure that the Windows host has at least this much before proceeding. It is also a good practice to tell VMware to split the virtual disk into 2G files. This will makes the image easier to copy and transport if necessary. Click "Next".
· Click "Finish" to complete the creation of the virtual machine.
- settings -> Storage -> Select the disk Icon
- On the right select Attributes browse the ISO you downloaded.Click OK.
- Now boot up Ubuntu VM ware - install normally like you do any OS installation.
- After installation, you will be prompted for reboot.
- Go to Machine ->Settings -> Storage -> Select the disk Icon
- On the right select Attributes Disk image and select remove the iso.
- Now boot up your VM again. You can use Ubuntu .
MISC:
Cloning:
Cloning:
When you want to clone the VMDK file. (Time
consuming, do not do it unless extremely necessary)
Grouping Boxes:
Group -> group (for better
classification)
Wednesday, 12 October 2016
JMeter Memory error
jmeter.threads.JMeterThread: Test failed! java.lang.OutOfMemoryError: Java heap space
As usual I turned to google and found out that this error can be forgone by increasing the Java heap space.
This line in jmeter.bat or jmeter.sh script which tells the launching instance of JMeter how much heap size it should use.
JVM_ARGS="-Xms512m -Xmx512m" jmeter.sh
I changed it to -Xms1024m at both places and relaunched JMeter. (Please Note that your system that has JMeter setup has sufficient RAM )
It FIXed the problem.
I am able to test the application now, crossing the previous 30k sample and going beyond till I stop the test manually.
Also I found the below article with a couple of more fixes that you might need in case you are facing the above error still.
Thursday, 1 September 2016
The decoration of objects
This is an image of tree rings. As you know the rings indicate the age of the tree.
Now coming to our example of Decorator pattern, the "first year of growth is our original object and the rest of the rings are the decorators"
Decorator pattern is used as an alternative for subclassing when we need the functionality to be extended. It is also an example of the Open- Closed Principle where we are allowed only to extend instead of modify.
When do we used decorator pattern?
When we have a set of large combination of two or more different sets of logic to be performed, instead of having a nightmare of derived classes we would rather bind the required logic dynamically.
Consider a web cam device that rotates and takes a photo everytime it senses motion of object in front of it.
Pseudo Code
InstructionCode ActionPerformed
CC Check if device is awake/Powered on
SS Check if sensor is functional
TT Take a snapshot
RR Rotate towards object of movement
DD Detect motion
MM TimerControl
Scenario 1:
The workflow will be such as
CC- Check if device is awake >> SS- Check if sensor is functional >> DD- Detect Motion >> RR- Rotate towards motion >> TT - Take Snapshot.
So the code you would need to write would be
CC SS DD RR TT
Scenario 2:
Now if the functionality of the device is changed to take pictures at every interval of time.
The workflow will be
CC- Check if device is awake >> MM- Timer Control >> TT- Take Snapshot.
So the code you would need to write would be
CC MM TT
In the above example we have limited number of instructions, consider writing a code for a IOT device which has numerous instruction sets all that need to be constructed to interact with a device. In such a scenario you would definitely prefer writing less code and opt for decorator pattern.
Below is a basic code example of an Ice Cream Preparation using decorator pattern.
The Ice Cream comes with a base Cone and with one scoop of ice cream.
It can be topped with chocolate sauce, sprinkles, gummy bears or all the above.
using System;
namespace IceCreamDecoration
{
public abstract class BaseCone
{
protected double myPrice;
public virtual double GetPrice()
{
return this.myPrice;
}
}
public abstract class IceCreamToppingsDecorator : BaseCone
{
protected BaseCone basecone;
public IceCreamToppingsDecorator(BaseCone baseconeToDecorate)
{
this.basecone = baseconeToDecorate;
}
public override double GetPrice()
{
return (this.basecone.GetPrice() + this.myPrice);
}
}
class Program
{
static void Main()
{
OneScoop basecone = new OneScoop();
Console.WriteLine("Just one scoop : " + basecone.GetPrice().ToString());
SprinklesTopping sprinkles = new SprinklesTopping(basecone);
SprinklesTopping moresprinkles = new SprinklesTopping(sprinkles);
Console.WriteLine("single scoup with sprinkles: " + moresprinkles.GetPrice().ToString());
GummyBearsTopping gummyBears = new GummyBearsTopping(moresprinkles);
Console.WriteLine("single scoup with more sprinkles and gummy bears: " + gummyBears.GetPrice().ToString());
ChocolateSauceTopping chocolateSauce = new ChocolateSauceTopping(gummyBears);
Console.WriteLine("single scoup with more sprinkles and gummy bears and chocolate sauce: " + chocolateSauce.GetPrice().ToString());
Console.ReadLine();
}
}
public class OneScoop : BaseCone
{
public OneScoop()
{
this.myPrice = 6.99;
}
}
public class Dessert : BaseCone
{
public Dessert()
{
this.myPrice = 7.49;
}
}
public class SprinklesTopping : IceCreamToppingsDecorator
{
public SprinklesTopping(BaseCone baseconeToDecorate)
: base(baseconeToDecorate)
{
this.myPrice = 0.99;
}
}
public class GummyBearsTopping : IceCreamToppingsDecorator
{
public GummyBearsTopping(BaseCone baseconeToDecorate)
: base(baseconeToDecorate)
{
this.myPrice = 1.49;
}
}
public class ChocolateSauceTopping : IceCreamToppingsDecorator
{
public ChocolateSauceTopping(BaseCone baseconeToDecorate)
: base(baseconeToDecorate)
{
this.myPrice = 2.49;
}
}
}
Tuesday, 16 August 2016
Setting up OTP Auth for your application with Google Auth
Below are the steps for helping you get started with it.
1. Get nugget package GoogleAuthenticator
2. Add the following code
TwoFactorAuthenticator tfa = new TwoFactorAuthenticator();
var setupCode = tfa.GenerateSetupCode("issuer", "accountTitle", "poiuytrewq123456", 300, 300);
string qrCodeImageUrl = setupCode.QrCodeSetupImageUrl;
string manualEntrySetupCode = setupCode.ManualEntryKey;
Console.WriteLine(manualEntrySetupCode);
Use any key in place of "poiuytrewq123456"
On execution of this code you will get a Manual Entry Setup Code.
3. Install GoogleAuthenticator on your phone from Google Play.
Open App Goto
Options >> Setup Account >> Enter Provided Key >> Enter the alphanumeric displayed by the above program and enter the same "accountTitle" given in the code above in the "Account Name" field.
Now your account is setup.
4. Add the following code to validate the OTP in your mobile.
Console.WriteLine("Enter OTP ");
string enteredOTP=Console.ReadLine();
bool isCorrectPIN = tfa.ValidateTwoFactorPIN("poiuytrewq123456", enteredOTP);
if (isCorrectPIN)
{
return true;
}
else
return false;
That's it you are done.
Run the Program
Enter the OTP in the console as shown in your mobile.
If the OTP matches you will get authenticated.
Will share the Github repo link.
Subscribe to:
Posts (Atom)

