jmeter while controller arşivleri • CanYouPwnMe! - For Cyber Security Researchers https://canyoupwn.me cypm! Sun, 23 Jul 2017 18:41:55 +0000 tr hourly 1 https://wordpress.org/?v=6.0 https://canyoupwn.me/wp-content/uploads/2016/02/cropped-Başlıksız-1-32x32.png jmeter while controller arşivleri • CanYouPwnMe! - For Cyber Security Researchers https://canyoupwn.me 32 32 TR | JMeter ile Stres Testi https://canyoupwn.me/jmeter-ile-stres-testi/ https://canyoupwn.me/jmeter-ile-stres-testi/#respond Fri, 22 Apr 2016 06:32:27 +0000 https://canyoupwn.me/?p=1815 CanYouPwnMe! - For Cyber Security Researchers CanYouPwnMe! - For Cyber Security Researchers - cypm!

Uygulamaların (web siteleri, web servisleri vb) gerçek kullanıcılar ile etkileşime geçmeden önce bazı öngörülen performans değerlerine ulaşıp ulaşmadığını tespit etmek ve kullanılabilirlik sınırlarını belirlemek için yapılan birtakım testler, yük, stress ve performans testi olarak adlandırılır. Maksimum sayıdaki kullanıcı ile periyodik bir şekilde sisteme yüklenilerek bir kaos ortamı yaratılır. Bu ortamda sistemin bu tür durumlara verdiği […]

TR | JMeter ile Stres Testi CanYouPwnMe

]]>
CanYouPwnMe! - For Cyber Security Researchers CanYouPwnMe! - For Cyber Security Researchers - cypm!

Uygulamaların (web siteleri, web servisleri vb) gerçek kullanıcılar ile etkileşime geçmeden önce bazı öngörülen performans değerlerine ulaşıp ulaşmadığını tespit etmek ve kullanılabilirlik sınırlarını belirlemek için yapılan birtakım testler, yük, stress ve performans testi olarak adlandırılır. Maksimum sayıdaki kullanıcı ile periyodik bir şekilde sisteme yüklenilerek bir kaos ortamı yaratılır. Bu ortamda sistemin bu tür durumlara verdiği tepki ölçülür.

Apache JMeter, performans ölçmek için dizayn edilmiş açık kaynaklı bir yazılımdır. %100 java koduyla yazılmış bu uygulama, ilk başta sadece web uygulamalarını test etmek için tasarlanmış, daha sonra ek testlerle desteklenmiştir. Apache JMeter hem statik hem de dinamik kaynakları test etmek için kullanılabilir. Örnek: Servlet, Perl script, Java nesnesi (Java Object), veri tabanı sunucusu (DBMS), FTP sunucusu v.b. Bir sunucu üzerinde birden fazla bağlantı açıp aynı zamanda birçok bağlantı yapılıyormuş gibi gösterebilmektedir. Bu sonuçları analiz etmek içinde grafiksel raporlama imkanları vardır.

Apache JMeter Özellikleri:

1- Birçok farklı sunucuyu test edebilir:  Web-HTTP, HTTPS, SOAP,JDBC yoluyla veritabanı,LDAP,JMS,Mail-POP3, IMAP

2- %100 Java dilinde yazılmış olduğundan platformdan bağımsız çalışabilir.

3- Swing package’i kullanıyor. (derlenmiş JAR javax.swing.* package’leri içeriyor)

4- Çok dizililiği (multithreading) kullandığından, koşut olarak birkaç işlev yapılabilir, çok kullanıcılı bir ortamı simule edebilir.

5- Kullanıcı arayüzü (GUI) kullanışlı olup, daha hızlı işlemekte ve daha doğru zamanlamayı (precise timing) sağlıyor.

6- Önbelleğe almayı (caching) kullanıp, sonuçları çevrim dışı (offline) olarak görme/analize etmeye olanak sağlıyor.

7- Genişletilebilirdir:

* Takılabilir örnekleyiciler (pluggable samplers) ile sonsuz test olanakları sağlıyor.

* Takılabilir Zamanlayıcılar (pluggable timers) ile birkaç yük istatistiği (loadstatistics) seçilebilir.

* Veri analizi ve görselleştirme takılabilirler (visualization plugin) ile genişleyebilirliği (extendibility) ve kişiselleştirmeyi (personalization) sağlamakta.

* İşlevler (JavaScript’i içermekte) bir test için devingen (dynamic) girdi oluşturmakta kullanılabilir.

* Yazılı yönergeli örnekleyiciler (scriptable samplers)

JMeterı Çalıştırma:
JMeter’i kullanmak için http://jakarta.apache.org/site/downloads/downloads_jmeter.cgi adresinden son sürümüni indirmeliyiz. İndirdiğimiz dosyanın içinde “bin” klasöründe jmeterw.cmd (Windows için) veya jmeter (Linux için) çalıştırmalıyız.

JMeter Http Uygulaması:

JMeterı açınca karşımıza hazır bir test planı gelir. İlk olarak test planımızda kullanıcıları oluşturmak için Thread grup ekleyelim. 100 kullanıcı oluşturduk.Ramp-Up Periyot değeri farklı varyasyonlarda testler için önemli bir değer. Saniye türünden girilen değer ile kullanıcı yükünün ne kadar sürede artarak devam edeceğinin belirtilmesini sağlar. Test Planı->Add->Threads(Users)->Thread Group

thread group

Daha sonra test edeceğimiz Url’ i belirtmek için bir Sampler ekledik. Http Request tipinde bir sampler ekledik. Server name kısmına test edeceğimiz siteyi yazdık. Thread Group->Add->Sampler->Http Requesthttp request

Sonuçları görebilmek için rapor grafiği ve sonuç tablosu oluşturalım. Daha farklı şekillerde sonuç almak istersek birçok Listener seçeneği mevcut. Test Planı->Add->Lİstener->Responce Time Graph

Test Planı->Add->Lİstener->View Result in Table

Sonuçlar,

table

 

Response Time Graph

Komut Satırı Kullanımı
Komut satırından kullanımı -n (non-gui) opsiyonu ile birlikte çalışmakta. İstenirse önceden GUI ile hazırlanmış bir JMX dosyasını -t parametresi ile belirterek yapılabilir. Bunun için önceden oluşturulmuş bir test JMX dosyası olması gerekmektedir. Yada jmeter-server’i daemon olarak çalıştırıp, uzaktaki bir makinadan GUI ile oluşturulan test JMX dosyasını sunucuya GUI üzerinden bağlanıp yollayabiliriz.
Örnek olarak: java -jar /path/ApacheJMeter.jar -n -t /path/Test.jmx
Birkaç parametre ve açıklamaları aşağıdadır:
-n Komut satırından GUI olmadan çalışmasını belirtir
-t  Yolu ile beraber Test planının olduğu JMX dosyasının adını belirtmeyi sağlar
-l  Yapılan test sırasında örnek taleplerin çıktılarını yazdığı JTL log dosyasının adı
-j  Jmeterin çalışırkenki durumları bildirdiği log dosyasının adı
-r  JMeter “remote_hosts” opsiyonu ile belirtilen uzak sunuculara testi başlatma komutunu bağlanıp gönderir
-R Uzak sunucuların listesini verir
-P proxy server port

Kullanıcı Tanımlı Değişkenler
Jmeter’da birçok alanda test yazarken farklı yazım şekillerini kullanırsınız. Jmeter statik ve dinamik yapıları test etmede kullanılırken test içeriği değişme olasılığı yüksektir. Çoğu kez tekrarladığınız yapıları bir değişkende toplamak veya değiştirmeye kalktığınızda tek bir yerden yönetmek testlerin esnek olması açısından önemlidir. Bunun için Jmeter’da kullanıcı tanımlı değişkenler kullanılmalıdır.
Kullanıcı tanımlı değişkenleri eklemek için TestPlan’a veya Thread Group’dan hangisinde kullanmak istiyorsanız ona ekleyebilirsiniz. Her bir Thread Group’un kendi değişkenleri ayrı tanımlanmasını isterseniz ayrı ayrı ekleyebilirsiniz. Thread Group’a bir UserDefinedVariables ekleyelim, bunun için Thread Group’a sağ tıklayalım ve Add > Config Element > User Defined Variables seçelim. Değişkenleri tanımlayabileceğimiz bir alan çıkacak. Burada Add’a tıklayarak yeni değişkenleri ekleyebiliriz.

Fonksiyon Kullanımı                                                                                                                                                                                                                                                                                                     JMeterda  esnek ve sürdürülebilir test planları yaratmak için kullanışlı fonksiyonlar mevcuttur.  Fonksiyon görünümü: ${__functionName(var1,var2,var3)} Örneğin, threadNum thread numarasını döndürür. FiletoString bir dosyayı okur. XPath, bir XML dosyasını okur ve XPath ile eşleştirir. machineName local host adını döndürür..

 

TR | JMeter ile Stres Testi CanYouPwnMe

]]>
https://canyoupwn.me/jmeter-ile-stres-testi/feed/ 0
EN | Stress Test with JMeter https://canyoupwn.me/stress-test-with-jmeter/ https://canyoupwn.me/stress-test-with-jmeter/#respond Fri, 22 Apr 2016 06:31:12 +0000 https://canyoupwn.me/?p=1822 CanYouPwnMe! - For Cyber Security Researchers CanYouPwnMe! - For Cyber Security Researchers - cypm!

Stress testing is a type of performance testing focused on determining an application’s robustness, availability, and reliability under extreme conditions. The goal of stress testing is to identify application issues that arise or become apparent only under extreme conditions. The Apache JMeter application is open source software, a 100% pure Java application designed to load […]

EN | Stress Test with JMeter CanYouPwnMe

]]>
CanYouPwnMe! - For Cyber Security Researchers CanYouPwnMe! - For Cyber Security Researchers - cypm!

Stress testing is a type of performance testing focused on determining an application’s robustness, availability, and reliability under extreme conditions. The goal of stress testing is to identify application issues that arise or become apparent only under extreme conditions.

The Apache JMeter application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.

JMeter Features

1-Ability to load and performance test many different server/protocol types: Web-HTTP, HTTPS, SOAP,FTP,Database via JDBC,LDAP,JMS,Mail-POP3, IMAP

2-Complate portability and %100 Java purity

3-It has full Swing and lightweight component support (precompiled JAR uses packages javax.swing.* )

4-Its full multi-threading framework allows concurrent sampling by many threads and simultaneous sampling of different functions by separate thread groups.

5-It has a simple and intuitive GUI.

6-Caching and offline analysis/replaying of test results.

7-Highly Extensible core:

Pluggable Samplers allow unlimited testing capabilities.

Several load statistics may be chosen with pluggable timers.

Data analysis and visualization plugins allow great extensibility as well as personalization.

Functions can be used to provide dynamic input to a test or provide data manipulation.

Scriptable Samplers (BeanShell, BSF-compatible languages and JSR223-compatible languages)

To run JMeter, run the jmeter.bat (for Windows) or jmeter (for Unix) file. These files are found in the bin directory. After a short time, the JMeter GUI should appear.

JMeter Http Request Application

There is already an empty Test Plan existing on JMeter. We start by adding a ‘Thread Group’ to our Test Plan. A Thread Group is something where you configure how many users you want to mimick. In the example below, I have got 100 users to hit the target within a timespan of 1 seconds.

Test Plan->Add->Threads->Thread Group

thread group

Then, we adding a sampler http Request type. So we can specify the url we’ll test.

Thread Group->Add->Sampler->Http Request

http request

We need a way of looking at the test results. And for that, we need to add some ‘Listeners’ to our Thread group. There are quite a few Listeners in there and they all capture exactly the same data, the only difference is how they treat the data. Each Listener has its own purpose and analyses the data differently. I have added 2 Listeners to my Test Plan above. ‘View Results in Table’, ‘Responce Time Graph‘.

Test Plan test->Add->Lİstener->Responce Time Graph, Test Plan->Add->Lİstener->View Result in Table

That’s it. The Test Plan is ready. We can now run the Test Plan and if everything has been setup properly, we should see the data coming in the Listeners.

table

 

Response Time Graph

Non-GUI Mode(Command Line Mode)

For non-interactive testing, you may choose to run JMeter without the GUI. To do so, use the following command options:

-n This specifies JMeter is to run in non-gui mode
-t [name of JMX file that contains the Test Plan].
-l [name of JTL file to log sample results to].
-j [name of JMeter run log file].
-r Run the test in the servers specified by the JMeter property “remote_hosts”
-R [list of remote servers] Run the test in the specified remote servers

The script also lets you specify the optional firewall/proxy server information:

-H [proxy server hostname or ip address]
-P [proxy server port]

Function and Variables

JMeter functions are special values that can populate fields of any Sampler or other element in a test tree. A function call looks like this:  ${__functionName(var1,var2,var3)}   Some functions,    samplerName:  get the sampler name (label), machineName:  get the local machine name, log:  log (or display) a message (and return the value) ,StringFromFİle: read a line from a file, XPath: Use an XPath expression to read from a file,  BeanShell: run a BeanShell script                                                                                                                                                                                                                                                                         

Pre-Defined Variables

Most variables are set by calling functions or by test elements such as User Defined Variables; in which case the user has full control over the variable name that is used. However some variables are defined internally by JMeter. These are listed below.

  • COOKIE_cookiename – contains the cookie value
  • JMeterThread.last_sample_ok – whether or not the last sample was OK – true/false. Note: this is updated after PostProcessors and Assertions have been run.
  • START variables

EN | Stress Test with JMeter CanYouPwnMe

]]>
https://canyoupwn.me/stress-test-with-jmeter/feed/ 0