Giter Club home page Giter Club logo

Comments (18)

webron avatar webron commented on May 18, 2024

From @fehguy on June 11, 2014 20:42

Can you elaborate more?

from swagger-play.

webron avatar webron commented on May 18, 2024

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.

webron avatar webron commented on May 18, 2024

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.

webron avatar webron commented on May 18, 2024

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.

webron avatar webron commented on May 18, 2024

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.

webron avatar webron commented on May 18, 2024

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.

webron avatar webron commented on May 18, 2024

@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.

webron avatar webron commented on May 18, 2024

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.

webron avatar webron commented on May 18, 2024

If it's Play then perhaps @fehguy will be able to assist. I'm not that familiar with the Play integration.

from swagger-play.

webron avatar webron commented on May 18, 2024

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.

webron avatar webron commented on May 18, 2024

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.

webron avatar webron commented on May 18, 2024

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.

webron avatar webron commented on May 18, 2024

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.

webron avatar webron commented on May 18, 2024

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.

webron avatar webron commented on May 18, 2024

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.

webron avatar webron commented on May 18, 2024

@fehguy - How is this related to the 1.5.X releases?

from swagger-play.

benmccann avatar benmccann commented on May 18, 2024

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.

lammel avatar lammel commented on May 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.