Comments (18)
From @fehguy on June 11, 2014 20:42
Can you elaborate more?
from swagger-play.
From @ghost on June 12, 2014 8:8
In what way are you asking this? Hope its not sarcastic. Because i'm just trying to make myself as clear as possible.
from swagger-play.
From @fehguy on June 12, 2014 16:18
um, no, i'm quite serious. are you talking about building swagger-core, your sample project, an integration test, a unit test, or what?
from swagger-play.
From @ghost on June 19, 2014 9:26
Sorry for my later response. I've been very busy lately.
If you run Play it starts with a "mode". This can be Dev/Test/Prod. Test mode wil be triggered if you run Unittests, intergration test or a Specs2(plugin for unit specifications and acceptance specifications). In test mode there is no need for swagger. But it will be triggered and the tests will be slowed down by swagger.
I Have managed to interupt swagger from running in testmode by adding "swagger.api.basepath=nonvalidurl" in the config file. This is a really dirty solution. i know :(
from swagger-play.
From @mauhiz on October 3, 2014 4:59
How slower does Swagger make things, exactly? Is scanning the annotations the slow part?
from swagger-play.
From @lammel on December 1, 2014 11:23
We are facing the same issue here. The annotation scanning results in a slowdown of our suite with 1000 tests considerable (running over 20min instead of 2min). It seems laso the swagger plugin initialization is getting slower and slower as the tests progress.
If there is a sane way to disable swagger doing the same scanning over and over for the tests any hints would be greatly appreciated.
from swagger-play.
@lammel - can you give a few more details about your application? Is it servlet, jax-rs, play? How is swagger-core configured?
from swagger-play.
From @lammel on December 1, 2014 11:47
It's a play 2.3 application currently with Scala 2.10 using "com.wordnik" %% "swagger-play2" % "1.3.10".
Tests do initialize the application afresh for most of the tests, so the scanning occurs pretty often.
We basically followed the README, just adding the routes to api-docs and having currently 2 classes with annotations (about 20 routes).
No additional configuration for swagger-core. To which kind of configuration are you refering?
from swagger-play.
If it's Play then perhaps @fehguy will be able to assist. I'm not that familiar with the Play integration.
from swagger-play.
From @lammel on December 1, 2014 12:26
Thanks, let's see if @fehguy has some time to spare for an answer. I just tried with swagger-play2 1.3.11. I'm still seeing a notable slowdown of plugin initialization after some tests (pretty fast initially at 160ms and slows down to approx 600ms after 50 tests and keeps on growing up to 2-3 seconds).
Memory has been checked (using jvisualvm), still memory free and permgen is also fine (both having approx 40% free).
Seems like computation requires more and more effort with each application init for testing.
from swagger-play.
From @fehguy on December 3, 2014 6:9
Hi, the SwaggerPlugin.scala is calling onStop()
, which is clearing the cache. My guess is that the slow down is due to garbage being generated and not cleaned up off the heap?
override def onStop() {
ApiListingCache.cache = None
Logger("swagger").info("Plugin - stopped");
}
from swagger-play.
From @lammel on December 4, 2014 16:14
Ok, so I would need to patch (comment out) that to verify. I see if I get around to doing that.
from swagger-play.
From @fehguy on December 23, 2014 22:49
We'll investigate and see if this can be done in the 1.5.0-M3 release.
from swagger-play.
From @mikalveli on December 24, 2014 4:8
I actually had this same problem today using the swagger-play2 plugin. In Play, you can disable plugins when using fakeApplication(). Here is the signature of the method:
public static FakeApplication fakeApplication(Map<String, ? extends Object> additionalConfiguration, List<String> additionalPlugins, List<String> withoutPlugins)
So in my particular case I'm using this call for each of my integration tests:
running(testServer(3333, fakeApplication(InMemoryDatabase.inMemoryDatabase(), new ArrayList<String>(), Arrays.asList("play.modules.swagger.SwaggerPlugin"))), HTMLUNIT, browser -> {
from swagger-play.
From @lammel on December 25, 2014 22:49
Ah, great, thanks! Should have looked more into FakeApplication instead of messing with the sbt plugin config. Using withoutPlugins for FakeApplikation works great and is looks to me like the right solution anyway.
If it should be documented I can provide a pull request for the text blurb. Any specific place where we should put that (e.g. readme)?
This should probably be documented, is there a place to put this (e.g. readme)?
from swagger-play.
@fehguy - How is this related to the 1.5.X releases?
from swagger-play.
I would be curious if this is any better/worse for swagger-play 1.5.0 that was just released for Play 2.4. It parses information from the routes file and does less scanning of annotations, which was indicated to be the slow part.
from swagger-play.
Just upgraded to 1.5.2. It is way better than before. Still tests are running twice as long when swagger is enabled so I chose again to disable it for now in tests.
We are running Play 2.4 with DI now, so we disable by configuring the fake application with "play.modules.disabled" to include "play.modules.swagger.SwaggerModule".
from swagger-play.
Related Issues (20)
- Update to Play 2.7 HOT 3
- @ApiModelProperty(hidden = true) doesn't work HOT 3
- Update to jackson-module-scala 2.9.8 HOT 1
- Route rule with optional package name for controllers (Play2.7) HOT 1
- Swagger timeout on HTTPS listener (and workaround)
- Use Swagger Core 2.x / OpenAPI 3.0 HOT 1
- ApiListingCache share same cache for different docRoots
- Hidding query parameter from the controller method HOT 1
- Scala 2.13.x support HOT 5
- Unable to load play routes after publishing build locally for play2.6
- Java Play 2.7 "CreationException: Unable to create injector:"
- Support play 2.8.x HOT 1
- Add support for vendor Extensions in API Info
- Method newInstance Deprecated as of Java 9
- Usage section isn't up-to-date? HOT 4
- oneOf, anyOf, allOf support? HOT 1
- controllers.ApiHelpController.getResource(path = "/users") picks up tags from other pathes
- Way to create swagger.json automatically HOT 9
- swagger.api.host default value
- jackson InvalidDefinitionException HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swagger-play.