Visualizzazione dei risultati da 1 a 7 su 7
  1. #1
    Utente di HTML.it
    Registrato dal
    Aug 2005
    Messaggi
    101

    web app java spring con 100 utenti

    Salve a tutti
    ho sviluppato una web app j2ee con spring , struts senza ejb
    quando supero i 100 utenti ibm we sphere va in out of memory e dumpa file enormi
    Che frame work e pooling di accesso al Db posso utilizzare per migliorare le performance della web app.
    Gli ejb 3 potrebbero fare al caso mio ?
    non posso usare hibernate .
    Considerato che il server ha HW limitato e non posso fare clustering
    grazie.

  2. #2
    Utente bannato
    Registrato dal
    Jul 2013
    Messaggi
    290
    chhèèèèè? ho capito una parola su due
    In pratica hai 100 utenti, ma non riesci a farti dare un server all'altezza?

  3. #3
    Utente di HTML.it
    Registrato dal
    Aug 2005
    Messaggi
    101
    Quote Originariamente inviata da brancomat Visualizza il messaggio
    chhèèèèè? ho capito una parola su due
    In pratica hai 100 utenti, ma non riesci a farti dare un server all'altezza?
    esatto

  4. #4
    Utente di HTML.it L'avatar di andbin
    Registrato dal
    Jan 2006
    residenza
    Italy
    Messaggi
    18,284
    Quote Originariamente inviata da belliazzi Visualizza il messaggio
    Che frame work e pooling di accesso al Db posso utilizzare per migliorare le performance della web app.
    Gli ejb 3 potrebbero fare al caso mio ?
    Un po' poco (e vago). Release di Java? Heap space max usato dalla JVM per l'application server? DBMS usato? Crei una connection ad ogni richiesta? (questo sì è pesante e consuma risorse)
    Ultima modifica di andbin; 08-10-2015 a 15:34
    Andrea, andbin.devSenior Java developerSCJP 5 (91%) • SCWCD 5 (94%)
    java.util.function Interfaces Cheat SheetJava Versions Cheat Sheet

  5. #5
    Utente di HTML.it
    Registrato dal
    Aug 2005
    Messaggi
    101
    Quote Originariamente inviata da andbin Visualizza il messaggio
    Un po' poco (e vago). Release di Java? Heap space max usato dall'application server? DBMS usato? Crei una connection ad ogni richiesta? (questo sì è pesante e consuma risorse)
    JAVA_VERSION="1.7.0"
    Oracle JDBC Driver

    Heap space IBM WEB SPHERE
    Initial heap size
    MB 256
    Maximum heap size
    MB 3072

    uso spring parametrizzato così


    connessione spring

    spring xml

    <bean id="applicationContextProvider" class="com.claimplus.common.ApplicationContextProv ider" />
    <context:annotation-config/>
    <!-- mio DB -->


    <!-- il transaction manager usato per le transazioni (db gypsy) -->
    <bean id="tjtJTransactionManager" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager" >
    <property name="dataSource" ref="tjtDataSource" />
    </bean>


    <bean id="tjtDataSource"
    class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName" value="jdbc/miodb"/>
    <property name="lookupOnStartup" value="false"/>
    <property name="cache" value="true"/>
    <property name="proxyInterface" value="javax.sql.DataSource"/>
    </bean>



    <bean id="CommonDAO" class="com.claimplus.hibernate.common.dao.CommonDA O" scope="singleton">
    <property name="dataSource" ref="tjtDataSource"/>
    <property name="transactionManager" ref="tjtJTransactionManager"/>
    </bean>




    nella mie classi DAO ho il seguente attributo

    CommonDAO connOracle =(CommonDAO) ApplicationContextProvider.getBean("CommonDAO") ;

    le query le eseguo così nelle classi java
    String strsql = " SELECT * from Table ";

    daQuery=connOracle.getJt().queryForList(strsql);


    di seguito tutta la classe CommonDAO


    /*
    * Progetto Claimplus 2015 ,user id :803285 ,team : Data Group srl
    * project name: ClaimPlusPersister
    */
    package com.claimplus.hibernate.common.dao;


    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;


    import javax.sql.DataSource;


    import org.apache.log4j.Logger;
    import org.springframework.jdbc.datasource.DataSourceTran sactionManager;


    import com.common.MyJdbcTemplate;
    import com.common.Utility;
    import com.common.exception.DatabaseException;
    import com.common.sigleton.LoginSingleton;




    // TODO: Auto-generated Javadoc
    /**
    * The Class CommonDAO.
    */
    public class CommonDAO {

    /** The Constant logger. */
    private static final Logger logger = Logger.getLogger(CommonDAO.class);





    /** The value. */
    public String value = null;

    /** The default value. */
    public String defaultValue = null;




    /** The jt. */
    private MyJdbcTemplate jt;

    /** The transaction manager. */
    private DataSourceTransactionManager transactionManager;

    /** The aia transaction manager. */
    private DataSourceTransactionManager aiaTransactionManager ;


    /**
    * Gets the aia transaction manager.
    *
    * @return the aia transaction manager
    */
    public DataSourceTransactionManager getAiaTransactionManager() {
    return aiaTransactionManager;
    }


    /**
    * Sets the aia transaction manager.
    *
    * @param aiaTransactionManager the new aia transaction manager
    */
    public void setAiaTransactionManager(
    DataSourceTransactionManager aiaTransactionManager) {
    this.aiaTransactionManager = aiaTransactionManager;
    }


    /**
    * Gets the transaction manager.
    *
    * @return the transaction manager
    */
    public DataSourceTransactionManager getTransactionManager() {
    return transactionManager;
    }


    /**
    * Sets the transaction manager.
    *
    * @param tm the new transaction manager
    */
    public void setTransactionManager(DataSourceTransactionManager tm) {
    this.transactionManager = tm;
    }


    /**
    * Sets the data source.
    *
    * @param dataSource the new data source
    */
    public void setDataSource(DataSource dataSource) {
    //this.dataSource = dataSource;
    this.jt= new MyJdbcTemplate(dataSource);
    }


    /**
    * Gets the jt.
    *
    * @return the jt
    */
    public MyJdbcTemplate getJt() {
    return jt;
    }


    /**
    * Sets the jt.
    *
    * @param jt the new jt
    */
    public void setJt(MyJdbcTemplate jt) {
    this.jt = jt;
    }

    /**
    * Execute update.
    *
    * @param sql the sql
    * @param operation the operation
    * @param table the table
    * @return the int
    */
    public int executeUpdate(String sql, String operation, String table) {
    logger.debug("Query " + operation + ": "+sql);
    int k = this.getJt().update(sql);
    logger.debug(operation + " into " + table + (k>0?"executed":"NOT executed"));
    return k;
    }


    /**
    * Execute select.
    *
    * @param sql the sql
    * @param table the table
    * @return true, if successful
    */
    public boolean executeSelect(String sql, String table) {
    logger.debug("Query SELECT: "+sql);
    MyJdbcTemplate.Row daQuery = this.getJt().queryForRow(sql);
    logger.debug("SELECT " + table + ((daQuery != null)?" successful":" UNsuccessful"));
    return (daQuery != null);

    }

    /**
    * Execute query.
    *
    * @param sql the sql
    * @param columName the colum name
    * @return the string
    * @throws DatabaseException the database exception
    */
    public String executeQuery(String sql, String columName) throws DatabaseException {
    String str = null;
    try{
    MyJdbcTemplate.Table daQuery = getJt().queryForTable(sql);
    if (daQuery!=null && daQuery.getList().size()>0) {
    str = (String)daQuery.getList().get(0).get(columName);
    }
    } catch(Exception e) {
    logger.error("exception in: "+sql, e);
    throw new DatabaseException("exception in: "+sql, e);
    }
    return str;
    }


    /**
    * Gets the column header.
    *
    * @param index the index
    * @param list the list
    * @param defaultValue the default value
    * @return the column header
    */

    /**
    * TEMPORANEO NON USARE.
    *
    * @throws DatabaseException the database exception
    * @deprecated
    */

    public void commit_() throws DatabaseException{
    String sql = "COMMIT;";
    MyJdbcTemplate.Table daQuery;
    try{
    daQuery = getJt().queryForTable(sql);
    } catch(Exception e) {
    logger.error("exception in: "+sql, e);
    throw new DatabaseException("exception in: "+sql, e);
    }
    }

    }
    Ultima modifica di belliazzi; 08-10-2015 a 15:56 Motivo: dati sensibili

  6. #6
    Facevi prima ad usare spring data già che hai messo sotto tutto il framework (gran bel progetto spring data). quindi tu arrivi a 100 utenti contemporanei e consumi tutte le risorse del server? usa un pool di connessioni al db invece del datasource secco così mettendoci tipo c3p0 (progetto penso morto ma ancora funziona) oppure alternative più recenti ( io volevo passare ad https://brettwooldridge.github.io/HikariCP/ ma ancora non l'ho testato).
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

  7. #7
    Utente di HTML.it
    Registrato dal
    Aug 2005
    Messaggi
    101
    Quote Originariamente inviata da Santino83_02 Visualizza il messaggio
    Facevi prima ad usare spring data già che hai messo sotto tutto il framework (gran bel progetto spring data). quindi tu arrivi a 100 utenti contemporanei e consumi tutte le risorse del server? usa un pool di connessioni al db invece del datasource secco così mettendoci tipo c3p0 (progetto penso morto ma ancora funziona) oppure alternative più recenti ( io volevo passare ad https://brettwooldridge.github.io/HikariCP/ ma ancora non l'ho testato).

    grazie.
    Purtroppo il progetto è stato un porting da un software visual basic di 15 anni fa . quindi ho dovuto arrivare a de compromessi tra codice e frame work.
    proverò a fare dei test con C3p0

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.