Précédent   Forum des professionnels en informatique > Logiciels > Solutions d'entreprise > Business Intelligence > BIRT
BIRT Forum d'entraide sur BIRT (Business Intelligence and Reporting Tools). Avant de poster --> FAQ BIRT,Tutoriels BIRT
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 28/07/2006, 14h33   #1
Candidat au titre de Membre du Club
 
Inscription : mars 2006
Messages : 17
Détails du profil
Informations forums :
Inscription : mars 2006
Messages : 17
Points : 12
Points : 12
Par défaut Lenteur lors de la 1ère génération

Mon problème est le suivant : lors de la 1ère génération d'un rapport la méthode run() de la tâche RunAndRender dure 10s et les fois suivantes uniquement 1s. C'est assez pénalisant.

Voila comment je produis mon rapport :
- j'ai une classe BirtEngine qui me crée un singleton ReportEngine :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
 
public class BirtEngine {
 
    private static IReportEngine birtEngine = null;
 
    private static Properties configProps = new Properties();
 
    private final static String configFile = "BirtConfig.properties";
 
    public static synchronized void initBirtConfig() {
        loadEngineProps();
    }
 
    public static synchronized IReportEngine getBirtEngine(ServletContext sc) {
        if (birtEngine == null) {
            EngineConfig config = new EngineConfig();
            if (configProps != null) {
                String logLevel = configProps.getProperty("logLevel");
                Level level = Level.OFF;
                if ("SEVERE".equalsIgnoreCase(logLevel)) {
                    level = Level.SEVERE;
                } else if ("WARNING".equalsIgnoreCase(logLevel)) {
                    level = Level.WARNING;
                } else if ("INFO".equalsIgnoreCase(logLevel)) {
                    level = Level.INFO;
                } else if ("CONFIG".equalsIgnoreCase(logLevel)) {
                    level = Level.CONFIG;
                } else if ("FINE".equalsIgnoreCase(logLevel)) {
                    level = Level.FINE;
                } else if ("FINER".equalsIgnoreCase(logLevel)) {
                    level = Level.FINER;
                } else if ("FINEST".equalsIgnoreCase(logLevel)) {
                    level = Level.FINEST;
                } else if ("OFF".equalsIgnoreCase(logLevel)) {
                    level = Level.OFF;
                }
 
                config.setLogConfig(configProps.getProperty("logDirectory"),
                        level);
            }
 
            config.setEngineHome("");
            IPlatformContext context = new PlatformServletContext(sc);
            config.setPlatformContext(context);
 
            HTMLEmitterConfig emitterConfig = new HTMLEmitterConfig( );
            emitterConfig.setActionHandler( new HTMLActionHandler( ) );
            HTMLServerImageHandler imageHandler = new HTMLServerImageHandler( );
            emitterConfig.setImageHandler( imageHandler );
            config.getEmitterConfigs( ).put( "html", emitterConfig ); //-NLS-1$
 
            try {
                Platform.startup(config);
            } catch (BirtException e) {
                e.printStackTrace();
            }
 
            IReportEngineFactory factory = (IReportEngineFactory) Platform
                    .createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
            birtEngine = factory.createReportEngine(config);
 
        }
        return birtEngine;
    }
 
    public static synchronized void destroyBirtEngine() {
        if (birtEngine == null) {
            return;
        }
        birtEngine.shutdown();
        Platform.shutdown();
        birtEngine = null;
    }
 
    public Object clone() throws CloneNotSupportedException {
        throw new CloneNotSupportedException();
    }
 
    private static void loadEngineProps() {
        try {
            // Config File must be in classpath
            ClassLoader cl = Thread.currentThread().getContextClassLoader();
            InputStream in = null;
            in = cl.getResourceAsStream(configFile);
            configProps.load(in);
            in.close();
 
        } catch (IOException e) {
            e.printStackTrace();
        }
 
    }
 
}
- mon singleton est initialisé au lancement de l'appli
- qd je veux produire mon rapport j'exécute le code suivant :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 
ServletContext lServletContext = pRequest.getSession()
				.getServletContext();
 
		IReportEngine lReportEngine = BirtEngine.getBirtEngine(lServletContext);
 
		// Open a report document
		IReportRunnable lReportDesign = lReportEngine
				.openReportDesign(lServletContext.getRealPath("/Reports")
						+ "\\" + pReportName);
 
		// Create Render Task
		IRunAndRenderTask lTask = lReportEngine
				.createRunAndRenderTask(lReportDesign);
 
		// Set Render context to handle url and image locataions
		HTMLRenderContext lRenderContext = new HTMLRenderContext();
		// You must define HTMLServerImageHandler to use a URL
		lRenderContext.setBaseImageURL(pRequest.getContextPath()
				+ "/images/reports");
		lRenderContext.setImageDirectory(lServletContext
				.getRealPath("/images/reports"));
		lRenderContext.setSupportedImageFormats("JPG;PNG;BMP");
 
		HashMap lContextMap = new HashMap();
		lContextMap.put(EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT,
				lRenderContext);
		lTask.setAppContext(lContextMap);
 
		// Set parameters
		Iterator<String> lKeys = pParameters.keySet().iterator();
		while (lKeys.hasNext()) {
			String lKey = lKeys.next();
			lTask.setParameterValue(lKey, pParameters.get(lKey));
		}
 
		// Set Render Options
		HTMLRenderOption lOptions = new HTMLRenderOption();
		ByteArrayOutputStream lBy = new ByteArrayOutputStream();
		lOptions.setOutputStream(lBy);
		lOptions.setEmbeddable(true);
		lTask.setRenderOption(lOptions);
 
		lTask.run();
		lTask.close();
 
		return lBy;
Dans ce code c'est la méthode run() qui prend 10s à la 1ère production du rapport et seulement 1s après. Quelqu'un pourrait-il m'aider à diminuer ce temps ?

Merci d'avance
KpTn est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/07/2006, 15h36   #2
BiM
Modératrice
 
Avatar de BiM
 
Femme
Consultante/Formatrice BIRT & Ingénieur Java/J2EE/GWT
Inscription : janvier 2005
Messages : 7 299
Détails du profil
Informations personnelles :
Sexe : Femme
Âge : 26
Localisation : France, Haute Garonne (Midi Pyrénées)

Informations professionnelles :
Activité : Consultante/Formatrice BIRT & Ingénieur Java/J2EE/GWT

Informations forums :
Inscription : janvier 2005
Messages : 7 299
Points : 8 650
Points : 8 650
C'est lent !!!

Bonne journée !
__________________
__~{@ BiM - Modératrice "Business Intelligence" @}~
Consultante/Formatrice BIRT & Ingénieur Java/J2EE/GWT
___________.~{@ Lapine crétine @}~
BiM est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 12h19.


 
 
 
 
Partenaires

Hébergement Web