Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
Datafari Load Testing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SandBoxesPublic
Datafari Load Testing
Commits
eedf96f6
Commit
eedf96f6
authored
2 years ago
by
Emeric Bernet-Rollande
Browse files
Options
Downloads
Patches
Plain Diff
Update README and remove useless imports
parent
814f8f15
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+12
-19
12 additions, 19 deletions
README.md
src/DatafariTestThreads.java
+12
-5
12 additions, 5 deletions
src/DatafariTestThreads.java
with
24 additions
and
24 deletions
README.md
+
12
−
19
View file @
eedf96f6
...
...
@@ -3,7 +3,9 @@
The projet consists in two Java classes to perform queries into Datafari/Solr.
The current code needs to be updated in order to work on modern versions of Datafari/Solr.
The current code in SolrTestThreads.java needs to be updated in order to work on modern versions of Solr.
The DatadariTestThreads.java performs queries specified in query_datafari.txt to the Datafari API
The txt files need to be filled with queries that will be sent to Solr/Datafari.
...
...
@@ -12,28 +14,19 @@ To find the top 1000 terms on the index :
We use the terms component.
We had to add this in the solrconfig.xml file :
```
<searchComponent name="terms" class="solr.TermsComponent"/>
<!-- A request handler for demonstrating the terms component -->
<requestHandler name="/terms" class="solr.SearchHandler" startup="lazy">
<lst name="defaults">
<bool name="terms">true</bool>
<bool name="distrib">true</bool>
</lst>
<arr name="components">
<str>terms</str>
</arr>
</requestHandler>
```
We obtain a list like that : "indic":100381, "joint":100212, "serv":99980, "mision":99952, "identific":99943
...
...
This diff is collapsed.
Click to expand it.
src/DatafariTestThreads.java
+
12
−
5
View file @
eedf96f6
...
...
@@ -8,13 +8,15 @@ import java.net.URI;
import
java.net.http.HttpClient
;
import
java.net.http.HttpRequest
;
import
java.net.http.HttpResponse
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
class
RunnableDemo
implements
Runnable
{
private
Thread
t
;
private
final
String
threadName
;
private
final
String
BASE_URL
=
"https://datafaritest.datafari.com/Datafari/rest/v2.0/search/select"
;
private
static
final
String
BASE_URL
=
"https://datafaritest.datafari.com/Datafari/rest/v2.0/search/select"
;
private
static
final
String
TXT_FILE
=
"/work/workspace/datafari-load-testing/src/query_datafari.txt"
;
RunnableDemo
(
String
name
)
{
threadName
=
name
;
...
...
@@ -35,7 +37,7 @@ class RunnableDemo implements Runnable {
double
globalTime
=
0.0
;
try
{
is
=
new
FileInputStream
(
"/data/workspace/datafari-load-testing/src/query_datafari.txt"
);
is
=
new
FileInputStream
(
TXT_FILE
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
...
...
@@ -44,11 +46,14 @@ class RunnableDemo implements Runnable {
try
(
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
is
));)
{
String
line
;
String
url
;
String
params
=
"&fl=title%2Curl%2Cid%2Cextension%2Cpreview_content%2Clast_modified%2Ccrawl_date%2Cauthor%2Coriginal_file_size%2Cemptied%2Crepo_source"
;
String
body
=
"{}"
;
while
((
line
=
br
.
readLine
())
!=
null
)
{
// Writing HTTP query
url
=
baseUrl
+
line
;
url
=
baseUrl
+
line
+
params
;
HttpClient
httpClient
=
HttpClient
.
newHttpClient
();
HttpRequest
request
=
HttpRequest
.
newBuilder
()
.
GET
()
...
...
@@ -60,14 +65,16 @@ class RunnableDemo implements Runnable {
try
{
response
=
httpClient
.
send
(
request
,
HttpResponse
.
BodyHandlers
.
ofString
());
String
body
=
response
.
body
();
body
=
response
.
body
();
JSONObject
obj
=
new
JSONObject
(
body
);
int
qtime
=
obj
.
getJSONObject
(
"responseHeader"
).
getInt
(
"QTime"
);
nbLines
++;
globalTime
+=
qtime
;
}
catch
(
IOException
|
InterruptedException
e
)
{
}
catch
(
IOException
|
InterruptedException
|
JSONException
e
)
{
System
.
out
.
println
(
"Thread "
+
threadName
+
" - Erreur sur la query : "
+
url
);
System
.
out
.
println
(
"Thread "
+
threadName
+
" - Erreur sur la query : "
+
body
);
e
.
printStackTrace
();
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment