Jmeter and MemCached Sets and Gets - java

So apologies if what I ask is trivial but I am experimenting with Memcached and Jmeter. I have a Memcached server setup (as far as I can tell) and am able to make telnet requests to it via telnet IP PORT and additionally set and get using commands set and get appropriately.
Now point me to a different application if perhaps this is the wrong choice; but my understanding was that Jmeter should allow me to pound the server with equivalent Set and Get requests.
Unfortunately the experimental platform is a remote linux PC running Rockylinux which is similar to CentOS / RedHat to my understanding (I didn't set this part up); and as a result I do not have a GUI to launch while on the Linux PC. I have however opened Jmeter up on my local PC on windows and understand I should be able to send the test file over and run it.
I followed these instructions to try to setup a TCP sampler and set the "text to send" field as below; after doing the additional step in the link regarding the precompiler.
set tutorialspoint 0 900 9${CR}${LF}
memcached${CR}${LF}
quit${CR}${LF}
Running the above as a headless jmeter session doesn't generate any errors called [./jmeter -n -t "Sample.jmx" -l testresults.jtl"] but when I connect via telnet I'm also not seeing the value for the key "tutorialspoint" get updated. When manually doing the get and set I am seeing updates. Any ideas what I could be doing wrong? Checking the log indicates ResponseCode 200 OK as expected. Is there a good method to debug something in a Headless setup?
Thanks for your time.

I believe the easiest way is using Memcached Java Client library
Download spymemcached-2.12.3.jar and drop it to "lib" folder of your JMeter installation (or any other location in JMeter Classpath)
Restart JMeter to pick the .jar up
Add JSR223 Sampler to your test plan and use the following code snippets:
def client = new net.spy.memcached.MemcachedClient(new InetSocketAddress('your-memcached-host', your-memcached-port)) - for connecting to the server
client.set('tutorialspoint', 900, 'memcached').done to write memcached to the tutorialspoint key for 15 minutes
client.get('tutorialspoint') - to read the value of tutorialspoint key
client.shutdown() - to disconnect
More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It
Demo:

Related

ftp.ControlChannelIOException: Connection reset(Talend/Java)

I have a requirement to pull the files and push the files from FTP Server but I am getting the below error while pulling/fetching the files from/into FTP server. I am using Talend Open Source Data Integration Tool, also tried using custom java code and getting the same error. While I am able to pull and fetch the files using FileZilla FTP Client. I am getting the error when I am trying to pull and push the files.
Error Start ..
com.enterprisedt.net.ftp.ControlChannelIOException: Connection reset
at
com.enterprisedt.net.ftp.FTPControlSocket.readLine(FTPControlSocket.java:1014)
at
com.enterprisedt.net.ftp.FTPControlSocket.readReply(FTPControlSocket.java:1049)
at
com.enterprisedt.net.ftp.FTPControlSocket.sendCommand(FTPControlSocket.java:973)
at
com.enterprisedt.net.ftp.FTPControlSocket.createDataSocketPASV(FTPControlSocket.java:807)
at
com.enterprisedt.net.ftp.FTPControlSocket.createDataSocket(FTPControlSocket.java:563)
at
com.enterprisedt.net.ftp.FTPClient.setupDataSocket(FTPClient.java:2561)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3468) at
vikas_sir.ftp_salesforce_and_vice_verasa_0_1.FTP_Salesforce_AND_Vice_Verasa.tFTPFileList_2Process(FTP_Salesforce_AND_Vice_Verasa.java:488) at
vikas_sir.ftp_salesforce_and_vice_verasa_0_1.FTP_Salesforce_AND_Vice_Verasa.tFTPConnection_1Process(FTP_Salesforce_AND_Vice_Verasa.java:396)
at
vikas_sir.ftp_salesforce_and_vice_verasa_0_1.FTP_Salesforce_AND_Vice_Verasa.runJobInTOS(FTP_Salesforce_AND_Vice_Verasa.java:1085) at
vikas_sir.ftp_salesforce_and_vice_verasa_0_1.FTP_Salesforce_AND_Vice_Verasa.main(FTP_Salesforce_AND_Vice_Verasa.java:942)
Error End ..
I have already tried the below things :
Allowed java application for my firewall e.g java.exe, javaw.exe and etc.
Also tried by disabling the firewall.
used netsh advfirewall set global StatefulFTP disable command as admin.
Disabled my antivirus.
Also added TLS1.1 and TLS 1.2 into .ini file.
Also tried in different Local Machines.
Tried by writing custom java code.
Below is link to the screenshot of the talend job :
Talend Job to pull the files from FTP server
Also when I am trying another FTP credentials, not getting(Can push and pull the files from/into FTP Server) any error.
Please let me know what/where I am doing wrong.
Any help will be greatly appreciated.
Thanks in Advance.
Amit

How to setup AWS Lambda service for a local server

I am trying to setup an application server for AWS Lambda but on a local network so that an application won't have to go out to the internet to execute. I would prefer to use a linux box and my programming environment is Java.
The skill from the echo will execute and then communicate with the local server rather than going out to the internet and communicating with Amazon's application server.
My question is this: How do I setup the application server to handle the skill? I've done the example from Amazon, do I only need to have the linux box run the Java application or is there more to the setup than that? I see there are AMIs (Amazon Machine Images) but can I deploy those locally or are they only for use on the AWS console?
Any insight into this would be great, thank you.
So this is how usual interaction between echo works:
User--->Echo--->Skill--->(Internet)Applicaton server (I'm using Amazon hosted AWS lambda)
I would like to use :
User--->Echo--->Skill--->(LAN)Application server (without ever using the internet).
Currently I have setup echo and a skill but no application server on the LAN. What do I need for the application server? JAWS and something else?
I'm not sure if this question is still relevant or not, but I'm using DEEP Framework to test the code locally and/or deploy it on AWS Lambda. Check this out:
npm install deepify -g
deepify run-lambda --help
run-lambda#1.6.8 - Run Lambda function locally
Usage example: deepify run-lambda path/to/the/lambda -e='{"Name":"John Doe"}'
Arguments:
path: The path to the Lambda (directory of handler itself)
Options:
--event|-e: JSON string used as the Lambda payload
--skip-frontend-build|-f: Skip picking up _build path from the microservices Frontend
--db-server|-l: Local DynamoDB server implementation (ex. LocalDynamo, Dynalite)
--version|-v: Prints command version
--help|-h: Prints command help
Also, you might want consider using the server option:
deepify server --help
server#1.6.9 - Run local development server
Usage example: deepify server path/to/web_app -o
Arguments:
path: The path to the Lambda (directory of handler itself)
Options:
--build-path|-b: The path to the build (in order to pick up config)
--skip-frontend-build|-f: Skip picking up _build path from the microservices Frontend
--skip-backend-build|-s: Skip building backend (dependencies installation in Lambdas and linking aws-sdk)
--skip-build-hook|-h: Skip running build hook (hook.build.js)
--port|-p: Port to listen to
--db-server|-l: Local DynamoDB server implementation (ex. LocalDynamo, Dynalite)
--open-browser|-o: Open browser after the server starts
--version|-v: Prints command version
--help|-h: Prints command help
Disclosure: I am one of the contributors to this framework

Rabbitmq exception com.rabbitmq.client.PossibleAuthenticationFailureException: Possibly caused by authentication failure [duplicate]

I've installed the latest RabbitMQ server (rabbitmq-server-3.3.0-1.noarch.rpm) on a fresh Centos 5.10 VM according to the instructions on the official site.
I've done this many times before during development and never had any issues. However, this time I cannot log into the management web interface using the default guest/guest user.
In the logs, I see the following:
=ERROR REPORT==== 4-Apr-2014::00:55:15 ===
webmachine error: path="api/whoami"
"Unauthorized"
What could be causing this?
It's new features since the version 3.3.0
http://www.rabbitmq.com/release-notes/README-3.3.0.txt
server
------
...
25603 prevent access using the default guest/guest credentials except via
localhost.
If you want enable the guest user read this or this RabbitMQ 3.3.1 can not login with guest/guest
# remove guest from loopback_users in rabbitmq.config like this
[{rabbit, [{loopback_users, []}]}].
# It is danger for default user and default password for remote access
# better to change password
rabbitmqctl change_password guest NEWPASSWORD
If you want create a new user with admin grants:
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
Now you can access using test test.
If you still can't access the management console after a fresh install, check if the management console was enabled. To enable it:
Go to the RabbitMQ command prompt.
Type:
rabbitmq-plugins enable rabbitmq_management
Something that just happened to me and caused me some headaches:
I have set up a new Linux RabbitMQ server and used a shell script to set up my own custom users (not guest!).
The script had several of those "code" blocks:
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
Very similar to the one in Gabriele's answer, so I take his code and don't need to redact passwords.
Still I was not able to log in in the management console. Then I noticed that I had created the setup script in Windows (CR+LF line ending) and converted the file to Linux (LF only), then reran the setup script on my Linux server.
... and was still not able to log in, because it took another 15 minutes until I realized that calling add_user over and over again would not fix the broken passwords (which probably ended with a CR character). I had to call change_password for every user to fix my earlier mistake:
rabbitmqctl change_password test test
(Another solution would have been to delete all users and then call the script again)
If on Windows and installed using chocolatey make sure firewall is allowing the default ports for it:
netsh advfirewall firewall add rule name="RabbitMQ Management" dir=in action=allow protocol=TCP localport=15672
netsh advfirewall firewall add rule name="RabbitMQ" dir=in action=allow protocol=TCP localport=5672
for the remote access.
I also couldn't log in to Rabbit's web interface. in my case, cookies were disabled in the browser for this web interface. I allowed cookies to be saved and rebooted chrome. and I was able to log in again.
If you are in Mac OS, you need to open the /usr/local/etc/rabbitmq/rabbitmq-env.conf and
set NODE_IP_ADDRESS=, it used to be 127.0.0.1. Then add another user as the accepted answer suggested.
After that, restart rabbitMQ, brew services restart rabbitmq

Java EE 7 updatetool installation fails

I have tried to install Java EE 7 with updatetool to be able to run Java EE Tutorial examples.
But the installation of updatetool fails. I have tried to start updatetool installation from the command line on my elementary os, then I saw the error when installing updatetool.
Here is an image: http://oi58.tinypic.com/x6iumx.jpg
Error text example 1:
Input/output error: Connection failed for URL http://pkg.oracle.com/javaeesdk/7/native/release/manifest/0/updatetool#2.3.5%2C0-56.2852%3A20111207T211721Z: 503: Service Temporarily Unavailable
Could not download application packages. This could be because:
- a proxy server is needed to access the internet. Please ensure that
the system proxy server settings are correct, or set the 'http_proxy'
environment variable to the full URL of the proxy server.
- the package server or network connection is slow.
If you are getting time out errors you can try setting the
PKG_CLIENT_CONNECT_TIMEOUT and PKG_CLIENT_READ_TIMEOUT
environment variables and try again. For example to increase
the timeouts to 300 seconds set them to 300
- the package server is down or otherwise inaccessible or it is
generating invalid data. Please contact the provider of the package
server.
Error text example 2:
File 138/564 Input/output error: Connection failed for URL http: //pkg.oracle.com/javaeesdk/7/native/release/file/0/217e83782a91f09fa7f35122412cd155263b107f: 502: Proxy Error
Could not download application packages. This could be because:
- a proxy server is needed to access the internet. Please ensure that
the system proxy server settings are correct, or set the 'http_proxy'
environment variable to the full URL of the proxy server.
- the package server or network connection is slow.
If you are getting time out errors you can try setting the
PKG_CLIENT_CONNECT_TIMEOUT and PKG_CLIENT_READ_TIMEOUT
environment variables and try again. For example to increase
the timeouts to 300 seconds set them to 300
- the package server is down or otherwise inaccessible or it is
generating invalid data. Please contact the provider of the package
server.
I don't use any proxy server. Help please!
I had the same - it's because their site is so unbelievably slow.
The output you showed tells you what to do, increase the timeout.
But sometimes it just needs to be run again, which worked in my case.
You can download the tutorial from Oracle Java EE 7 SDK download page.
Just download the latest Java EE 7 SDK, and unzip. The tutorial is inside the glassfish4/docs folder.
I have managed to install updatetool finally, after 3 days.
My advice for everyone who has the same problem:
Try installation several times in the morning, afternoon, evening and at night. And maybe once you will have successful attempt :)
The problem was not on my side.

How can I monitor/log Tomcat's thread pool?

I have a Tomcat installation where I suspect the thread pool may be decreasing over time due to threads not being properly released. I get an error in catalina.out when maxthreads is reached, but I would like to log the number of threads in use to a file every five minutes so I can verify this hypothesis. Would anyone please be able to advise how this can be be done?
Also in this installation there is no Tomcat manager, it appears whoever did the original installation deleted the manager webapp for some reason. I'm not sure if manager would be able to do the above or if I can reinstall it without damaging the existing installation? All I really want to do is keep track of the thread pool.
Also, I noticed that maxthreads for Tomcat is 200, but the max number of concurrent connections for Apache is lower (Apache is using mod_proxy and mod_proxy_ajp (AJP 1.3) to feed Tomcat). That seems wrong too, what is the correct relationship between these numbers?
Any help much appreciated :D
Update: Just a quick update to say the direct JMX access worked. However I also had to set Dcom.sun.management.jmxremote.host. I set it to localhost and it worked, however without it no dice. If anyone else has a similar problem trying to enable JMX I recommend you set this value also, even if you are connecting from the local machine. Seems it is required with some versions of Tomcat.
Just a quick update to say the direct JMX access worked. However I also had to set Dcom.sun.management.jmxremote.host. I set it to localhost and it worked, however without it no dice. If anyone else has a similar problem trying to enable JMX I recommend you set this value also, even if you are connecting from the local machine. Seems it is required with some versions of Tomcat.
Direct JMX access
Try adding this to catalina.sh/bat:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=5005
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
UPDATE: Alex P suggest that the following settings might also be required in some situations:
-Dcom.sun.management.jmxremote.host=localhost
This enables remote anonymous JMX connections on port 5005. You may also consider JVisualVM which is much more please and allows to browse JMX via plugin.
What you are looking for is Catalina -> ThreadPool -> http-bio-8080 -> various interesting metrics.
JMX proxy servlet
Easier method might be to use Tomcat's JMX proxy servlet under: http://localhost:8080/manager/jmxproxy. For instance try this query:
$ curl --user tomcat:tomcat http://localhost:8080/manager/jmxproxy?qry=Catalina:name=%22http-bio-8080%22,type=ThreadPool
A little bit of grepping and scripting and you can easily and remotely monitor your application. Note that tomcat:tomcat is the username/password of user having manager-jmx role in conf/tomcat-users.xml.
You can deploy jolokia.war and then retrieve mbeans values in JSON (without the manager):
http://localhost:8080/jolokia/read/Catalina:name=*,type=ThreadPool?ignoreErrors=true
If you want only some values (currentThreadsBusy, maxThreads, currentThreadCount, connectionCount):
http://localhost:8080/jolokia/read/Catalina:name=*,type=ThreadPool/currentThreadsBusy,maxThreads,currentThreadCount,connectionCount?ignoreErrors=true
{
request: {
mbean: "Catalina:name="http-nio-8080",type=ThreadPool",
attribute: [
"currentThreadsBusy",
"maxThreads",
"currentThreadCount",
"connectionCount"
],
type: "read"
},
value: {
currentThreadsBusy: 1,
connectionCount: 4,
currentThreadCount: 10,
maxThreads: 200
},
timestamp: 1490396960,
status: 200
}
Note: This example works on Tomcat7 +.
For a more enterprise solution. I have been using New Relic in our production environment.
This provides a graph of the changes to the threadpool over time.
There are cheaper tools out meanwhile: I am using this jar here: https://docs.cyclopsgroup.org/jmxterm
You can automate it via shell/batch scripts. I regexed the output and let prometheus poll it for displaying it in grafana.

Categories

Resources