Unguarded logging slows down Geotools in benchmarks
---------------------------------------------------
Key: GEOT-1420
URL: http://jira.codehaus.org/browse/GEOT-1420
Project: GeoTools
Issue Type: Bug
Components: core feature
Affects Versions: 2.3.2, 2.4-M4
Reporter: Andrea Aime
Assignee: Andrea Aime
Fix For: 2.4-RC0, 2.3.3
A user reported a benchmark where unguarded finer logs are slowing down
significantly the performance of Geotools/Geoserver:
{panel}
THE SCENARY:
>
> We have verified a test stress with geoserver-geotools and
> google-maps, this test have realized with tptp plugin from Eclipse,
> we are using MySql-spatial and the table has a lot of fields, the test
> was with 3 fields (ID, GEOMETRY, NAME) and 380 fields.
>
> THE WORKAROROUND:
>
> the results with 3 fields was seemed , but with 380 came down, too slow.
> tptp was clear, a method "setAttributePath" from
> AttributeExpressionImpl class, was the responsable.
>
> THE CODE:
>
> /**
> * Constructor with minimum dataset for a valid expression.
> *
> * @param attPath The initial (required) sub filter.
> *
> * @throws IllegalFilterException If the attribute path is not in the
> * schema.
> */
> public void setAttributePath(String attPath) throws
> IllegalFilterException {
> LOGGER.entering("ExpressionAttribute", "setAttributePath",
> attPath);
> LOGGER.finest("schema: " + schema + "\n\nattribute: " + attPath);
>
> if (schema != null) {
> if (schema.hasAttributeType(attPath)) {
> this.attPath = attPath;
> } else {
> throw new IllegalFilterException(
> "Attribute: " +attPath+ " is not in stated schema
> "+schema.getTypeName()+".");
> }
> } else {
> this.attPath = attPath;
> }
> }
>
> and the line:
> LOGGER.finest("schema: " + schema + "\n\nattribute: " + attPath);
> you can see that schema call toString method from
> DefaultFeatureType class.
>
> the code:
>
> public String toString() {
> String info = "name=" + typeName;
> info += (" , namespace=" + namespace);
> info += (" , abstract=" + isAbstract());
>
> String types1 = "types=(";
>
> for (int i = 0, ii = this.types.length; i < ii; i++) {
> types1 += this.types[i].toString();
>
> if (i < ii) {
> types1 += ",";
> }
> }
>
> types1 += ")";
> info += (" , " + types1);
>
> return "DefaultFeatureType [" + info + "]";
> }
>
> with 380 fields this a lot of workaround.
>
> THE SOLUTION:
>
> but with the simple code for the method setAttributePath:
>
> if (LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("schema: " + schema
> + "\n\nattribute: " + attPath);
> Don“t call (schema) tostring method.
>
> THE INFO:
> http://logging.apache.org/log4net/release/sdk/log4net.ILog.IsDebugEnabled.html
>
>
> THE RESULTS:
>
> with the original line:
> LOGGER.finest("schema: " + schema + "\n\nattribute: " + attPath);
> Hits: 815
> Average hits per second: 2,69
>
> with the new code
>
> if (LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("schema: " + schema
> + "\n\nattribute: " + attPath);
>
> Hits: 3152
> Average hits per second: 37,524
>
> WOOOOOOOOOWWWWWWWWW .
>
> there are a lot of LOGGER.finest
{panel}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel