saw303 / grails-ic-alender

iCalender Plugin for Grails
http://grails.org/plugin/ic-alendar
Other
8 stars 11 forks source link

A new UidGenerator is being created for each event causing many hostname lookups #18

Closed craigweston closed 8 years ago

craigweston commented 8 years ago

When generating many events at a once, there is a large spike in DNS traffic. After digging through the source, I noticed that a new UidGenerate is created for each event:

currentEvent.properties << new UidGenerator('iCalPlugin-Grails').generateUid()

Looking at the constructor implementation of the net.fortuna.ical4j.util.UidGenerator, you can see that this will create a new InetAddressHostInfo each time, instead of allowing it to just use a cached copy:

    /**
     * @param pid a unique process identifier for the host machine
     * @throws SocketException where host information cannot be retrieved
     */
    public UidGenerator(String pid) throws SocketException {
        this(new InetAddressHostInfo(), pid);
    }

If the UidGenerator was created once per ICalendarBuilder, there would be far less reverse name lookups performed.

saw303 commented 8 years ago

Thank you for reporting. I will take a look at it. Are using the Grails 2.x or the Grails 3.x version of the plugin?

craigweston commented 8 years ago

I'm using the Grails 2.x version.

saw303 commented 8 years ago

Released on Grails 2.x version 0.4.6

craigweston commented 8 years ago

Thank you.

saw303 commented 8 years ago

you are welcome. Thanks for using the plugin