apib | A simple , fast HTTP and API benchmarking tool | HTTP library
kandi X-RAY | apib Summary
kandi X-RAY | apib Summary
This is a tool that makes it easy to run performance tests of HTTP API servers. It can be built on most Linux platforms, plus Mac OS X and FreeBSD.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of apib
apib Key Features
apib Examples and Code Snippets
Community Discussions
Trending Discussions on apib
QUESTION
I have two API that are publicly exposed, let's say xyz.com/apiA and xyz.com/apiB.
Both these API are running node and are dockerized services running as individual pods in the same namespace of a Kubernetes cluster.
Now, apiA calls apiB internally as part of its code logic. The apiA service makes a POST call to apiB and sends with it a somewhat large payload in its body parameter. This POST request times out if the payload in its body is more than 30kb.
We have checked the server logs and that POST request is not seen.
The error prompt shows connection timeout to 20.xx.xx.xx which is the public ip address of xyz.com
I'm new to Kubernetes and would appreciate your help.
So far have tried this, but it didn't help.
Please let me know if more information is needed.
Edit: kubectl client and server version is 1.22.0
...ANSWER
Answered 2021-Sep-04 at 08:41To update the kind folks who took time to understand the problem and suggest solutions - The issue was due to bad routing. Internal APIs (apiB in the example above) should not be called using full domain name of xyz.com/apiB, rather they can be directly referenced using pod name as
http://pod_name.namespace.svc.local/apiB
.
This will ensure internal calls are routed through Kubernetes DNS and don't have to go through load balancer and nginx, thus improving response time heavily.
Every call made to apiA was creating a domino effect by populating hundreds of calls to apiB and overloading the server, which caused it to fail only after a few thousand requests.
Lesson learned: Route all internal calls using cluster's internal network.
QUESTION
I'm implementing a Scala/Play API (apiA) which consumes an API (apiB) that I have no control over. ApiB returns a JSON response which in some cases has JSON embedded into strings. Example:
...ANSWER
Answered 2020-Feb-08 at 12:52case class Response(name: String, scores: Seq[Seq[Int]], data: Map[String, String])
import play.api.libs.json._
val stringified = Reads[JsValue] {
_.validate[String].flatMap { raw =>
try {
JsSuccess(Json.parse(raw))
} catch {
case cause =>
JsError(cause.getMessage)
}
}
}
implicit val respReads = Reads[Response] { js =>
for {
name <- (js \ "name").validate[String]
scores <- (js \ "scores").validate(
stringified).flatMap(_.validate[Seq[Seq[Int]]])
data <- (js \ "data").validate(
stringified).flatMap(_.validate[Map[String, String]])
} yield Response(name, scores, data)
}
Json.parse("""{
"name":"some_name",
"scores": "[[10,15]]",
"data": "{\"attr1\":\"value1\",\"attr2\":\"value3\"}"
}""").validate[Response]
// JsSuccess(Response(some_name,Vector(Vector(10, 15)),Map(attr1 -> value1, attr2 -> value3)),)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install apib
Running: How to run apib
Building: How to build it from source
Remote Montitoring: How to remotely monitor servers under test
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page