Samplers: Samplers tell JMeter to send a request to a server and wait for a response. Following is the list of JMeter Samplers:
FTP Request
HTTP Request
JDBC Request
Java Request
SOAP/XML-RPC Request
WebService (SOAP)
@RunWith(SpringRunner.class) | |
@TestPropertySource("classpath:server-test.properties") | |
public class SpelUnitTest { | |
public static final Logger logger = LoggerFactory.getLogger(Sample.class); | |
@Value("${testclock.start}") | |
private String startTime; | |
@Autowired |
The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.
In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.
This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.
/** | |
* @author rchytas | |
* | |
* Use any way you like :) | |
* | |
*/ | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileWriter; |
/** | |
* Author: Domenico Monaco, Yong Mook Kim | |
* | |
* Source: https://gist.github.com/kiuz/816e24aa787c2d102dd0 | |
* | |
* License: GNU v2 2014 | |
* | |
* Fork / Learned: http://www.mkyong.com/java/how-to-detect-os-in-java-systemgetpropertyosname/ | |
* | |
*/ |
I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\